Padrino 0.13.3 - Generator changes, mailer rendering, proper URL escaping for link_to and form_tag helpers, new helper method, bug fixes
Padrino 0.13.3 was shipped in August 2016. This version contains generator changes, mailer rendering, proper URL escaping for link_to
and form_tag
helpers, new helper method, bug fixes.
Generator changes
No generator support for:
- riot (last change is from October 2013)
- steak (last change is from January 2012)
- rightjs (last project update from March 2012)
For more details see this commit.
Mailer rendering
Implemented new way to call render in mailers. It allows to omit mailer name or mailer name and message name.
Example:
mailer :sample do
message :message2
render 'congrats' #=> renders from 'sample/congrats'
end
message :message1
render #=> renders from 'sample/message1'
end
end
For more details check #1907 allow clipped render calls in mailer (@ujifgc). Thanks to @jf for posting this idea.
link_to
and form_tag
URL escaping
There has been an inconsistency between image_tag
and link_to
/form_tag
in escaping URIs:
puts(image_tag 'image name.jpeg')
# => <img src="/images/image%20name.jpeg?1459513767" />
# previous behavior
link_to 'image title', 'image name.jpeg')
# => <a href="image name.jpeg">image title</a>
# actual behavior
link_to 'image title', 'image name.jpeg')
# => <img src="/images/image%20name.jpeg?1459513767" />
For more details check #2016 escape urls in link_to
and form_tag
(@ujifgc).
Thanks to @jf for posting this idea.
New helper method escape_link
Example:
escape_link('http://example.com/spaced link')
# => 'http://example.com/spaced%20link'
escape_link('already%20partially escaped')
# => 'already%20partially%20escaped'
More details under tag_helpers.rb.
Bug Fixes and Miscellaneous
There are several bug fixes and other updates:
- FIX #1662 make Reloader remove module constants (this occurred when source code is changed under a running padrino application)
- FIX #2036 do not mutate route name String (@ujifgc)
- FIX #2024 Do not override access control object when registered in multiple apps (nx6)
- FIX #2045 Prevent overwriting params by given query (@namusyaka)
- NEW #1872 implement using partials without Sinatra, closes (@ujifgc)
- FIX #2052 String#humanize compatibility with AS ~3.2 (@ujifgc)
- NEW #2050 Update Moneta to 0.8.0 (@basex)
- NEW #2056 Allow Pry as Padrino console shell (@ujifgc)
- NEW github issue template (@ujifgc)
- FIX #2066 Fix reloader with native jruby classes (@ujifgc)
Contribute
Padrino 0.13.2 - New Project Flag, Component Upgrades and Bug Fixes
Padrino 0.13.1 was shipped just over 3 months ago in January 2016 and since then we have had many issues reported and fixed. After a few months of effort, we are excited to announce the release of Padrino 0.13.2! This version is filled with a new project generator flag, minimizing dependence on AS, upgrading a few components and a number of other bug fixes.
New API Project Generator Flag
In this release, we've introduced a new project generator flag of --api
. When this flag is used during project generation, the following changes are applied to the new project:
- Project only has
padrino-core
andpadrino-gen
listed as dependencies in the Gemfile. Padrino::Mailer
andPadrino::Helpers
are not registered or referenced in the project.- Automatically sets
:renderer
,:scripts
, and:stylesheet
tonone
in.components
.
You can see more about this in pull request #1921. Thanks to @ujifgc for implementing this.
Simplified Initializers
Many apps have configuration code that needs to run first as the project starts up before the application is loaded. Padrino has always supported this with initializers in lib/NAME_initializer.rb
. However, there were no guarantees that this code would run before other project code leading to dependency issues due to loading order. In this release, we have introduced the config/initializers
folder which get loaded once during startup before any other app code is loaded. Initializers look like this:
# config/initializers/some_useful.rb
# code run once after Padrino.before_load before Padrino.after_load
# good place to define some plugin-related constants
module SomeUsefulInitializer
def self.registered(app)
# this is where we setup components or configuration for the project
end
end
In your app code, for example app/app.rb
, we can register this with:
register SomeUsefulInitializer
You can see more about this in pull request #2032. Thanks to @ujifgc for implementing this.
Minimize ActiveSupport Dependence
Over the last few releases, we have been working to minimize our dependency on ActiveSupport
. Note that at this time the library is still a required dependency. However, we are incrementally removing all uses of this library from the internals of Padrino whenever possible.
For those interested, we've removed many ActiveSupport methods from internal usage including but not limited to:
- active_support/time
- activesupport/timewith_zone
- array#prepend
- hash#except
- hash#with_options
- cattr_accessor
- hash#reverse_merge
- aliasmethodchain
Thanks to @ujifgc for leading these efforts.
Component Upgrades
We've upgraded or fixed a few components:
- FIX #1789 Relax Tilt version to allow Tilt 2 (>= 1.4.1, < 3) (@ujifgc)
- FIX #2011 Update mongoid database configuration (@serradura)
Bug Fixes and Miscellaneous
There are several bug fixes and other updates:
- WARN #1989 Warn about coming behavior change (@ujifgc)
- NEW #1987 Generator now fails with invalid namespace (@ujifgc)
- FIX #2007 Respect Regexp#names at the time of route search (@namusyaka)
- FIX #2004 Set default alt attribute for image_tag (@namusyaka)
- FIX #2008 Login button on the admin app now looks as expected (@namusyaka)
- FIX Remove empty rows and cols from textarea tag (@ujifgc)
- FIX #2015 Update broken links in the README and docs (@mariozig)
- FIX #2023 Preserve
default_builder
set in configure_apps (@ujifgc) - FIX #2025 Match plugin names with dashes in their names (@wikimatze)
- FIX #2029 Don't set a value attribute on label tags (@sshaw)
- WARN Notice about removing ObjectSpace.classes and ObjectSpace.new_classes in 0.14 (@ujifgc)
- FIX #2027 Use Module#name instead of Module#to_s (@namusyaka)
- NEW Logger option :sanitize_encoding (@ujifgc)
- FIX #2006 load missing AR models before calling seeds.rb (@ujifgc)