New Plugins ¶ ↑
A run_append_slash plugin has been added, which automatically uses “/” as the path instead of an empty path when calling rack applications with r.run:
route do |r| r.on "a" do r.run App end end # without run_append_slash: # GET /a => App gets "" as PATH_INFO # GET /a/ => App gets "/" as PATH_INFO # with run_append_slash: # GET /a => App gets "/" as PATH_INFO # GET /a/ => App gets "/" as PATH_INFO
By default, the path is modified directly, but if you want to redirect instead, you can pass a :use_redirects option when loading the plugin.
New Features¶ ↑
The assets plugin now supports an :sri option to enable subresource integrity on the link/script tags generated by the assets helper. This option takes either :sha256, :sha384, or :sha512 values, specifying the hash algorithm to use.
Roda3 will default to using :sri => :sha256.
The assets plugin now supports a :postprocessor option, which should be a callable object. If the option is given, it will be called with the filename, type, and rendered asset output of the file (CSS/JS), and should return the postprocessed content to use. This allows any type of custom postprocessing to be done, such as CSS autoprefixing.
The render plugin now supports a :layout_opts=>:merge_locals option, which will automatically merge view template locals into layout template locals. This is useful if you want to use the same local variable for both templates.
The error_handler plugin now supports a :classes option, allowing you to override which exception classes to handle. This allows it to be used with libraries which use exception classes that subclass from Exception instead of StandardError.
Other Improvements¶ ↑
The type_routing plugin now works correctly when using r.run. Previously, if the type routing plugin recognized and removed the file extension used in the requested path, it would not add the file extension back to the path when passing the request to another rack app.
Backwards Compatibility¶ ↑
In the assets plugin, Roda::RodaRequest.assets_matchers now uses symbols instead of strings as the first argument in each entry. This should not affect you unless you were accessing the values directly.