2017-02-27 13:51:26 -05:00
|
|
|
* Remove the option `encode_special_chars` misnomer from `strip_tags`
|
|
|
|
|
|
|
|
As of rails-html-sanitizer v1.0.3 sanitizer will ignore the
|
|
|
|
`encode_special_chars` option. Fixes #28060.
|
|
|
|
|
|
|
|
*Andrew Hood*
|
|
|
|
|
2017-02-23 14:53:12 -05:00
|
|
|
## Rails 5.1.0.beta1 (February 23, 2017) ##
|
|
|
|
|
2017-01-20 18:02:34 -05:00
|
|
|
* Change the ERB handler from Erubis to Erubi.
|
|
|
|
|
|
|
|
Erubi is an Erubis fork that's svelte, simple, and currently maintained.
|
|
|
|
Plus it supports `--enable-frozen-string-literal` in Ruby 2.3+.
|
|
|
|
|
|
|
|
Compatibility: Drops support for `<%===` tags for debug output.
|
|
|
|
These were an unused, undocumented side effect of the Erubis
|
|
|
|
implementation.
|
|
|
|
|
|
|
|
Deprecation: The Erubis handler will be removed in Rails 5.2, for the
|
|
|
|
handful of folks using it directly.
|
|
|
|
|
|
|
|
*Jeremy Evans*
|
|
|
|
|
2017-01-15 08:41:39 -05:00
|
|
|
* Allow render locals to be assigned to instance variables in a view.
|
|
|
|
|
|
|
|
Fixes #27480.
|
|
|
|
|
|
|
|
*Andrew White*
|
|
|
|
|
2017-01-02 11:26:05 -05:00
|
|
|
* Add `check_parameters` option to `current_page?` which makes it more strict.
|
|
|
|
|
|
|
|
*Maksym Pugach*
|
|
|
|
|
2016-12-26 22:47:31 -05:00
|
|
|
* Return correct object name in form helper method after `fields_for`.
|
|
|
|
|
|
|
|
Fixes #26931.
|
|
|
|
|
|
|
|
*Yuji Yaginuma*
|
|
|
|
|
2016-12-05 13:30:27 -05:00
|
|
|
* Use `ActionView::Resolver.caching?` (`config.action_view.cache_template_loading`)
|
|
|
|
to enable template recompilation.
|
|
|
|
|
|
|
|
Before it was enabled by `consider_all_requests_local`, which caused
|
|
|
|
recompilation in tests.
|
|
|
|
|
|
|
|
*Max Melentiev*
|
|
|
|
|
2016-11-21 14:57:39 -05:00
|
|
|
* Add `form_with` to unify `form_tag` and `form_for` usage.
|
|
|
|
|
|
|
|
Used like `form_tag` (where just the open tag is output):
|
|
|
|
|
|
|
|
```erb
|
|
|
|
<%= form_with scope: :post, url: super_special_posts_path %>
|
|
|
|
```
|
|
|
|
|
|
|
|
Used like `form_for`:
|
|
|
|
|
|
|
|
```erb
|
|
|
|
<%= form_with model: @post do |form| %>
|
|
|
|
<%= form.text_field :title %>
|
|
|
|
<% end %>
|
|
|
|
```
|
|
|
|
|
|
|
|
*Kasper Timm Hansen*, *Marek Kirejczyk*
|
|
|
|
|
|
|
|
* Add `fields` form helper method.
|
|
|
|
|
|
|
|
```erb
|
|
|
|
<%= fields :comment, model: @comment do |fields| %>
|
|
|
|
<%= fields.text_field :title %>
|
|
|
|
<% end %>
|
|
|
|
```
|
|
|
|
|
|
|
|
Can also be used within form helpers such as `form_with`.
|
|
|
|
|
|
|
|
*Kasper Timm Hansen*
|
|
|
|
|
2016-10-10 01:20:11 -04:00
|
|
|
* Removed deprecated `#original_exception` in `ActionView::Template::Error`.
|
|
|
|
|
|
|
|
*Rafael Mendonça França*
|
|
|
|
|
2016-11-12 13:14:49 -05:00
|
|
|
* Render now accepts any keys for locals, including reserved keywords.
|
2016-09-30 13:55:38 -04:00
|
|
|
|
|
|
|
Only locals with valid variable names get set directly. Others
|
2016-11-12 13:14:49 -05:00
|
|
|
will still be available in `local_assigns`.
|
2016-09-30 13:55:38 -04:00
|
|
|
|
2016-11-12 13:14:49 -05:00
|
|
|
Example of render with reserved keywords:
|
2016-09-30 13:55:38 -04:00
|
|
|
|
|
|
|
```erb
|
|
|
|
<%= render "example", class: "text-center", message: "Hello world!" %>
|
|
|
|
|
|
|
|
<!-- _example.html.erb: -->
|
|
|
|
<%= tag.div class: local_assigns[:class] do %>
|
|
|
|
<p><%= message %></p>
|
|
|
|
<% end %>
|
|
|
|
```
|
|
|
|
|
|
|
|
*Peter Schilling*, *Matthew Draper*
|
|
|
|
|
2016-07-14 06:38:16 -04:00
|
|
|
* Show cache hits and misses when rendering partials.
|
|
|
|
|
|
|
|
Partials using the `cache` helper will show whether a render hit or missed
|
|
|
|
the cache:
|
|
|
|
|
|
|
|
```
|
|
|
|
Rendered messages/_message.html.erb in 1.2 ms [cache hit]
|
|
|
|
Rendered recordings/threads/_thread.html.erb in 1.5 ms [cache miss]
|
|
|
|
```
|
|
|
|
|
|
|
|
This removes the need for the old fragment cache logging:
|
|
|
|
|
|
|
|
```
|
|
|
|
Read fragment views/v1/2914079/v1/2914079/recordings/70182313-20160225015037000000/d0bdf2974e1ef6d31685c3b392ad0b74 (0.6ms)
|
|
|
|
Rendered messages/_message.html.erb in 1.2 ms [cache hit]
|
|
|
|
Write fragment views/v1/2914079/v1/2914079/recordings/70182313-20160225015037000000/3b4e249ac9d168c617e32e84b99218b5 (1.1ms)
|
|
|
|
Rendered recordings/threads/_thread.html.erb in 1.5 ms [cache miss]
|
|
|
|
```
|
|
|
|
|
|
|
|
Though that full output can be reenabled with
|
|
|
|
`config.action_controller.enable_fragment_cache_logging = true`.
|
|
|
|
|
|
|
|
*Stan Lo*
|
|
|
|
|
2016-08-07 13:14:31 -04:00
|
|
|
* Changed partial rendering with a collection to allow collections which
|
|
|
|
implement `to_a`.
|
|
|
|
|
|
|
|
Extracting the collection option had an optimization to avoid unnecessary
|
|
|
|
queries of ActiveRecord Relations by calling `#to_ary` on the given
|
|
|
|
collection. Instances of `Enumerator` or `Enumerable` are valid
|
|
|
|
collections, but they do not implement `#to_ary`. By changing this to
|
|
|
|
`#to_a`, they will now be extracted and rendered as expected.
|
|
|
|
|
|
|
|
*Steven Harman*
|
|
|
|
|
2016-06-27 13:00:54 -04:00
|
|
|
* New syntax for tag helpers. Avoid positional parameters and support HTML5 by default.
|
|
|
|
Example usage of tag helpers before:
|
|
|
|
|
|
|
|
```ruby
|
|
|
|
tag(:br, nil, true)
|
|
|
|
content_tag(:div, content_tag(:p, "Hello world!"), class: "strong")
|
|
|
|
|
|
|
|
<%= content_tag :div, class: "strong" do -%>
|
|
|
|
Hello world!
|
|
|
|
<% end -%>
|
|
|
|
```
|
|
|
|
|
|
|
|
Example usage of tag helpers after:
|
|
|
|
|
|
|
|
```ruby
|
|
|
|
tag.br
|
|
|
|
tag.div tag.p("Hello world!"), class: "strong"
|
|
|
|
|
|
|
|
<%= tag.div class: "strong" do %>
|
|
|
|
Hello world!
|
|
|
|
<% end %>
|
|
|
|
```
|
|
|
|
|
|
|
|
*Marek Kirejczyk*, *Kasper Timm Hansen*
|
|
|
|
|
2016-06-22 12:44:26 -04:00
|
|
|
* Change `datetime_field` and `datetime_field_tag` to generate `datetime-local` fields.
|
2016-06-21 21:37:42 -04:00
|
|
|
|
2016-06-22 12:44:26 -04:00
|
|
|
As a new specification of the HTML 5 the text field type `datetime` will no longer exist
|
2016-08-10 00:02:22 -04:00
|
|
|
and it is recommended to use `datetime-local`.
|
2016-06-21 21:37:42 -04:00
|
|
|
Ref: https://html.spec.whatwg.org/multipage/forms.html#local-date-and-time-state-(type=datetime-local)
|
|
|
|
|
|
|
|
*Herminio Torres*
|
|
|
|
|
2016-06-21 17:08:48 -04:00
|
|
|
* Raw template handler (which is also the default template handler in Rails 5) now outputs
|
|
|
|
HTML-safe strings.
|
|
|
|
|
|
|
|
In Rails 5 the default template handler was changed to the raw template handler. Because
|
|
|
|
the ERB template handler escaped strings by default this broke some applications that
|
|
|
|
expected plain JS or HTML files to be rendered unescaped. This fixes the issue caused
|
|
|
|
by changing the default handler by changing the Raw template handler to output HTML-safe
|
|
|
|
strings.
|
|
|
|
|
|
|
|
*Eileen M. Uchitelle*
|
|
|
|
|
2016-05-21 12:32:55 -04:00
|
|
|
* `select_tag`'s `include_blank` option for generation for blank option tag, now adds an empty space label,
|
2016-06-23 08:10:53 -04:00
|
|
|
when the value as well as content for option tag are empty, so that we conform with html specification.
|
2016-05-08 17:06:58 -04:00
|
|
|
Ref: https://www.w3.org/TR/html5/forms.html#the-option-element.
|
|
|
|
|
|
|
|
Generation of option before:
|
2016-05-21 12:32:55 -04:00
|
|
|
|
2016-05-08 17:06:58 -04:00
|
|
|
```html
|
|
|
|
<option value=""></option>
|
|
|
|
```
|
2016-05-21 12:32:55 -04:00
|
|
|
|
|
|
|
Generation of option after:
|
2016-05-08 17:06:58 -04:00
|
|
|
|
|
|
|
```html
|
|
|
|
<option value="" label=" "></option>
|
|
|
|
```
|
|
|
|
|
2016-05-21 12:32:55 -04:00
|
|
|
*Vipul A M*
|
2016-05-06 17:54:40 -04:00
|
|
|
|
2016-05-10 00:07:09 -04:00
|
|
|
Please check [5-0-stable](https://github.com/rails/rails/blob/5-0-stable/actionview/CHANGELOG.md) for previous changes.
|