actionview 5.2.4.1 → 6.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of actionview might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +193 -79
- data/MIT-LICENSE +1 -1
- data/README.rdoc +4 -2
- data/lib/action_view.rb +3 -2
- data/lib/action_view/base.rb +107 -10
- data/lib/action_view/buffers.rb +15 -0
- data/lib/action_view/cache_expiry.rb +54 -0
- data/lib/action_view/context.rb +5 -9
- data/lib/action_view/digestor.rb +12 -20
- data/lib/action_view/gem_version.rb +4 -4
- data/lib/action_view/helpers.rb +0 -2
- data/lib/action_view/helpers/asset_tag_helper.rb +7 -30
- data/lib/action_view/helpers/asset_url_helper.rb +4 -3
- data/lib/action_view/helpers/cache_helper.rb +18 -10
- data/lib/action_view/helpers/capture_helper.rb +4 -0
- data/lib/action_view/helpers/csp_helper.rb +4 -2
- data/lib/action_view/helpers/csrf_helper.rb +1 -1
- data/lib/action_view/helpers/date_helper.rb +69 -25
- data/lib/action_view/helpers/form_helper.rb +238 -6
- data/lib/action_view/helpers/form_options_helper.rb +27 -18
- data/lib/action_view/helpers/form_tag_helper.rb +12 -9
- data/lib/action_view/helpers/javascript_helper.rb +9 -8
- data/lib/action_view/helpers/number_helper.rb +5 -0
- data/lib/action_view/helpers/output_safety_helper.rb +1 -1
- data/lib/action_view/helpers/rendering_helper.rb +6 -4
- data/lib/action_view/helpers/sanitize_helper.rb +12 -18
- data/lib/action_view/helpers/tag_helper.rb +7 -6
- data/lib/action_view/helpers/tags/base.rb +9 -5
- data/lib/action_view/helpers/tags/color_field.rb +1 -1
- data/lib/action_view/helpers/tags/translator.rb +1 -6
- data/lib/action_view/helpers/text_helper.rb +3 -3
- data/lib/action_view/helpers/translation_helper.rb +16 -12
- data/lib/action_view/helpers/url_helper.rb +14 -14
- data/lib/action_view/layouts.rb +5 -5
- data/lib/action_view/log_subscriber.rb +6 -6
- data/lib/action_view/lookup_context.rb +73 -31
- data/lib/action_view/path_set.rb +5 -10
- data/lib/action_view/railtie.rb +24 -1
- data/lib/action_view/record_identifier.rb +2 -2
- data/lib/action_view/renderer/abstract_renderer.rb +56 -3
- data/lib/action_view/renderer/partial_renderer.rb +66 -55
- data/lib/action_view/renderer/partial_renderer/collection_caching.rb +62 -16
- data/lib/action_view/renderer/renderer.rb +16 -4
- data/lib/action_view/renderer/streaming_template_renderer.rb +5 -5
- data/lib/action_view/renderer/template_renderer.rb +24 -18
- data/lib/action_view/rendering.rb +51 -31
- data/lib/action_view/routing_url_for.rb +12 -11
- data/lib/action_view/template.rb +102 -70
- data/lib/action_view/template/error.rb +21 -1
- data/lib/action_view/template/handlers.rb +27 -1
- data/lib/action_view/template/handlers/builder.rb +2 -2
- data/lib/action_view/template/handlers/erb.rb +17 -7
- data/lib/action_view/template/handlers/erb/erubi.rb +7 -3
- data/lib/action_view/template/handlers/html.rb +1 -1
- data/lib/action_view/template/handlers/raw.rb +2 -2
- data/lib/action_view/template/html.rb +14 -5
- data/lib/action_view/template/inline.rb +22 -0
- data/lib/action_view/template/raw_file.rb +28 -0
- data/lib/action_view/template/resolver.rb +136 -133
- data/lib/action_view/template/sources.rb +13 -0
- data/lib/action_view/template/sources/file.rb +17 -0
- data/lib/action_view/template/text.rb +5 -3
- data/lib/action_view/test_case.rb +1 -1
- data/lib/action_view/testing/resolvers.rb +33 -20
- data/lib/action_view/unbound_template.rb +32 -0
- data/lib/action_view/view_paths.rb +25 -1
- data/lib/assets/compiled/rails-ujs.js +29 -3
- metadata +25 -17
- data/lib/action_view/helpers/record_tag_helper.rb +0 -23
| @@ -590,6 +590,9 @@ module ActionView | |
| 590 590 | 
             
                  #   Skipped if a <tt>:url</tt> is passed.
         | 
| 591 591 | 
             
                  # * <tt>:scope</tt> - The scope to prefix input field names with and
         | 
| 592 592 | 
             
                  #   thereby how the submitted parameters are grouped in controllers.
         | 
| 593 | 
            +
                  # * <tt>:namespace</tt> - A namespace for your form to ensure uniqueness of
         | 
| 594 | 
            +
                  #   id attributes on form elements. The namespace attribute will be prefixed
         | 
| 595 | 
            +
                  #   with underscore on the generated HTML id.
         | 
| 593 596 | 
             
                  # * <tt>:model</tt> - A model object to infer the <tt>:url</tt> and
         | 
| 594 597 | 
             
                  #   <tt>:scope</tt> by, plus fill out input field values.
         | 
| 595 598 | 
             
                  #   So if a +title+ attribute is set to "Ahoy!" then a +title+ input
         | 
| @@ -610,8 +613,8 @@ module ActionView | |
| 610 613 | 
             
                  #   unnecessary unless you support browsers without JavaScript.
         | 
| 611 614 | 
             
                  # * <tt>:local</tt> - By default form submits are remote and unobtrusive XHRs.
         | 
| 612 615 | 
             
                  #   Disable remote submits with <tt>local: true</tt>.
         | 
| 613 | 
            -
                  # * <tt>:skip_enforcing_utf8</tt> -  | 
| 614 | 
            -
                  #   is output | 
| 616 | 
            +
                  # * <tt>:skip_enforcing_utf8</tt> - If set to true, a hidden input with name
         | 
| 617 | 
            +
                  #   utf8 is not output.
         | 
| 615 618 | 
             
                  # * <tt>:builder</tt> - Override the object used to build the form.
         | 
| 616 619 | 
             
                  # * <tt>:id</tt> - Optional HTML id attribute.
         | 
| 617 620 | 
             
                  # * <tt>:class</tt> - Optional HTML class attribute.
         | 
| @@ -1127,6 +1130,9 @@ module ActionView | |
| 1127 1130 | 
             
                  #   text_field(:post, :title, class: "create_input")
         | 
| 1128 1131 | 
             
                  #   # => <input type="text" id="post_title" name="post[title]" value="#{@post.title}" class="create_input" />
         | 
| 1129 1132 | 
             
                  #
         | 
| 1133 | 
            +
                  #   text_field(:post, :title,  maxlength: 30, class: "title_input")
         | 
| 1134 | 
            +
                  #   # => <input type="text" id="post_title" name="post[title]" maxlength="30" size="30" value="#{@post.title}" class="title_input" />
         | 
| 1135 | 
            +
                  #
         | 
| 1130 1136 | 
             
                  #   text_field(:session, :user, onchange: "if ($('#session_user').val() === 'admin') { alert('Your login cannot be admin!'); }")
         | 
| 1131 1137 | 
             
                  #   # => <input type="text" id="session_user" name="session[user]" value="#{@session.user}" onchange="if ($('#session_user').val() === 'admin') { alert('Your login cannot be admin!'); }"/>
         | 
| 1132 1138 | 
             
                  #
         | 
| @@ -1519,10 +1525,10 @@ module ActionView | |
| 1519 1525 |  | 
| 1520 1526 | 
             
                  private
         | 
| 1521 1527 | 
             
                    def html_options_for_form_with(url_for_options = nil, model = nil, html: {}, local: !form_with_generates_remote_forms,
         | 
| 1522 | 
            -
                      skip_enforcing_utf8:  | 
| 1528 | 
            +
                      skip_enforcing_utf8: nil, **options)
         | 
| 1523 1529 | 
             
                      html_options = options.slice(:id, :class, :multipart, :method, :data).merge(html)
         | 
| 1524 1530 | 
             
                      html_options[:method] ||= :patch if model.respond_to?(:persisted?) && model.persisted?
         | 
| 1525 | 
            -
                      html_options[:enforce_utf8] = !skip_enforcing_utf8
         | 
| 1531 | 
            +
                      html_options[:enforce_utf8] = !skip_enforcing_utf8 unless skip_enforcing_utf8.nil?
         | 
| 1526 1532 |  | 
| 1527 1533 | 
             
                      html_options[:enctype] = "multipart/form-data" if html_options.delete(:multipart)
         | 
| 1528 1534 |  | 
| @@ -1674,6 +1680,227 @@ module ActionView | |
| 1674 1680 | 
             
                    @index = options[:index] || options[:child_index]
         | 
| 1675 1681 | 
             
                  end
         | 
| 1676 1682 |  | 
| 1683 | 
            +
                  ##
         | 
| 1684 | 
            +
                  # :method: text_field
         | 
| 1685 | 
            +
                  #
         | 
| 1686 | 
            +
                  # :call-seq: text_field(method, options = {})
         | 
| 1687 | 
            +
                  #
         | 
| 1688 | 
            +
                  # Wraps ActionView::Helpers::FormHelper#text_field for form builders:
         | 
| 1689 | 
            +
                  #
         | 
| 1690 | 
            +
                  #   <%= form_with model: @user do |f| %>
         | 
| 1691 | 
            +
                  #     <%= f.text_field :name %>
         | 
| 1692 | 
            +
                  #   <% end %>
         | 
| 1693 | 
            +
                  #
         | 
| 1694 | 
            +
                  # Please refer to the documentation of the base helper for details.
         | 
| 1695 | 
            +
             | 
| 1696 | 
            +
                  ##
         | 
| 1697 | 
            +
                  # :method: password_field
         | 
| 1698 | 
            +
                  #
         | 
| 1699 | 
            +
                  # :call-seq: password_field(method, options = {})
         | 
| 1700 | 
            +
                  #
         | 
| 1701 | 
            +
                  # Wraps ActionView::Helpers::FormHelper#password_field for form builders:
         | 
| 1702 | 
            +
                  #
         | 
| 1703 | 
            +
                  #   <%= form_with model: @user do |f| %>
         | 
| 1704 | 
            +
                  #     <%= f.password_field :password %>
         | 
| 1705 | 
            +
                  #   <% end %>
         | 
| 1706 | 
            +
                  #
         | 
| 1707 | 
            +
                  # Please refer to the documentation of the base helper for details.
         | 
| 1708 | 
            +
             | 
| 1709 | 
            +
                  ##
         | 
| 1710 | 
            +
                  # :method: text_area
         | 
| 1711 | 
            +
                  #
         | 
| 1712 | 
            +
                  # :call-seq: text_area(method, options = {})
         | 
| 1713 | 
            +
                  #
         | 
| 1714 | 
            +
                  # Wraps ActionView::Helpers::FormHelper#text_area for form builders:
         | 
| 1715 | 
            +
                  #
         | 
| 1716 | 
            +
                  #   <%= form_with model: @user do |f| %>
         | 
| 1717 | 
            +
                  #     <%= f.text_area :detail %>
         | 
| 1718 | 
            +
                  #   <% end %>
         | 
| 1719 | 
            +
                  #
         | 
| 1720 | 
            +
                  # Please refer to the documentation of the base helper for details.
         | 
| 1721 | 
            +
             | 
| 1722 | 
            +
                  ##
         | 
| 1723 | 
            +
                  # :method: color_field
         | 
| 1724 | 
            +
                  #
         | 
| 1725 | 
            +
                  # :call-seq: color_field(method, options = {})
         | 
| 1726 | 
            +
                  #
         | 
| 1727 | 
            +
                  # Wraps ActionView::Helpers::FormHelper#color_field for form builders:
         | 
| 1728 | 
            +
                  #
         | 
| 1729 | 
            +
                  #   <%= form_with model: @user do |f| %>
         | 
| 1730 | 
            +
                  #     <%= f.color_field :favorite_color %>
         | 
| 1731 | 
            +
                  #   <% end %>
         | 
| 1732 | 
            +
                  #
         | 
| 1733 | 
            +
                  # Please refer to the documentation of the base helper for details.
         | 
| 1734 | 
            +
             | 
| 1735 | 
            +
                  ##
         | 
| 1736 | 
            +
                  # :method: search_field
         | 
| 1737 | 
            +
                  #
         | 
| 1738 | 
            +
                  # :call-seq: search_field(method, options = {})
         | 
| 1739 | 
            +
                  #
         | 
| 1740 | 
            +
                  # Wraps ActionView::Helpers::FormHelper#search_field for form builders:
         | 
| 1741 | 
            +
                  #
         | 
| 1742 | 
            +
                  #   <%= form_with model: @user do |f| %>
         | 
| 1743 | 
            +
                  #     <%= f.search_field :name %>
         | 
| 1744 | 
            +
                  #   <% end %>
         | 
| 1745 | 
            +
                  #
         | 
| 1746 | 
            +
                  # Please refer to the documentation of the base helper for details.
         | 
| 1747 | 
            +
             | 
| 1748 | 
            +
                  ##
         | 
| 1749 | 
            +
                  # :method: telephone_field
         | 
| 1750 | 
            +
                  #
         | 
| 1751 | 
            +
                  # :call-seq: telephone_field(method, options = {})
         | 
| 1752 | 
            +
                  #
         | 
| 1753 | 
            +
                  # Wraps ActionView::Helpers::FormHelper#telephone_field for form builders:
         | 
| 1754 | 
            +
                  #
         | 
| 1755 | 
            +
                  #   <%= form_with model: @user do |f| %>
         | 
| 1756 | 
            +
                  #     <%= f.telephone_field :phone %>
         | 
| 1757 | 
            +
                  #   <% end %>
         | 
| 1758 | 
            +
                  #
         | 
| 1759 | 
            +
                  # Please refer to the documentation of the base helper for details.
         | 
| 1760 | 
            +
             | 
| 1761 | 
            +
                  ##
         | 
| 1762 | 
            +
                  # :method: phone_field
         | 
| 1763 | 
            +
                  #
         | 
| 1764 | 
            +
                  # :call-seq: phone_field(method, options = {})
         | 
| 1765 | 
            +
                  #
         | 
| 1766 | 
            +
                  # Wraps ActionView::Helpers::FormHelper#phone_field for form builders:
         | 
| 1767 | 
            +
                  #
         | 
| 1768 | 
            +
                  #   <%= form_with model: @user do |f| %>
         | 
| 1769 | 
            +
                  #     <%= f.phone_field :phone %>
         | 
| 1770 | 
            +
                  #   <% end %>
         | 
| 1771 | 
            +
                  #
         | 
| 1772 | 
            +
                  # Please refer to the documentation of the base helper for details.
         | 
| 1773 | 
            +
             | 
| 1774 | 
            +
                  ##
         | 
| 1775 | 
            +
                  # :method: date_field
         | 
| 1776 | 
            +
                  #
         | 
| 1777 | 
            +
                  # :call-seq: date_field(method, options = {})
         | 
| 1778 | 
            +
                  #
         | 
| 1779 | 
            +
                  # Wraps ActionView::Helpers::FormHelper#date_field for form builders:
         | 
| 1780 | 
            +
                  #
         | 
| 1781 | 
            +
                  #   <%= form_with model: @user do |f| %>
         | 
| 1782 | 
            +
                  #     <%= f.date_field :born_on %>
         | 
| 1783 | 
            +
                  #   <% end %>
         | 
| 1784 | 
            +
                  #
         | 
| 1785 | 
            +
                  # Please refer to the documentation of the base helper for details.
         | 
| 1786 | 
            +
             | 
| 1787 | 
            +
                  ##
         | 
| 1788 | 
            +
                  # :method: time_field
         | 
| 1789 | 
            +
                  #
         | 
| 1790 | 
            +
                  # :call-seq: time_field(method, options = {})
         | 
| 1791 | 
            +
                  #
         | 
| 1792 | 
            +
                  # Wraps ActionView::Helpers::FormHelper#time_field for form builders:
         | 
| 1793 | 
            +
                  #
         | 
| 1794 | 
            +
                  #   <%= form_with model: @user do |f| %>
         | 
| 1795 | 
            +
                  #     <%= f.time_field :borned_at %>
         | 
| 1796 | 
            +
                  #   <% end %>
         | 
| 1797 | 
            +
                  #
         | 
| 1798 | 
            +
                  # Please refer to the documentation of the base helper for details.
         | 
| 1799 | 
            +
             | 
| 1800 | 
            +
                  ##
         | 
| 1801 | 
            +
                  # :method: datetime_field
         | 
| 1802 | 
            +
                  #
         | 
| 1803 | 
            +
                  # :call-seq: datetime_field(method, options = {})
         | 
| 1804 | 
            +
                  #
         | 
| 1805 | 
            +
                  # Wraps ActionView::Helpers::FormHelper#datetime_field for form builders:
         | 
| 1806 | 
            +
                  #
         | 
| 1807 | 
            +
                  #   <%= form_with model: @user do |f| %>
         | 
| 1808 | 
            +
                  #     <%= f.datetime_field :graduation_day %>
         | 
| 1809 | 
            +
                  #   <% end %>
         | 
| 1810 | 
            +
                  #
         | 
| 1811 | 
            +
                  # Please refer to the documentation of the base helper for details.
         | 
| 1812 | 
            +
             | 
| 1813 | 
            +
                  ##
         | 
| 1814 | 
            +
                  # :method: datetime_local_field
         | 
| 1815 | 
            +
                  #
         | 
| 1816 | 
            +
                  # :call-seq: datetime_local_field(method, options = {})
         | 
| 1817 | 
            +
                  #
         | 
| 1818 | 
            +
                  # Wraps ActionView::Helpers::FormHelper#datetime_local_field for form builders:
         | 
| 1819 | 
            +
                  #
         | 
| 1820 | 
            +
                  #   <%= form_with model: @user do |f| %>
         | 
| 1821 | 
            +
                  #     <%= f.datetime_local_field :graduation_day %>
         | 
| 1822 | 
            +
                  #   <% end %>
         | 
| 1823 | 
            +
                  #
         | 
| 1824 | 
            +
                  # Please refer to the documentation of the base helper for details.
         | 
| 1825 | 
            +
             | 
| 1826 | 
            +
                  ##
         | 
| 1827 | 
            +
                  # :method: month_field
         | 
| 1828 | 
            +
                  #
         | 
| 1829 | 
            +
                  # :call-seq: month_field(method, options = {})
         | 
| 1830 | 
            +
                  #
         | 
| 1831 | 
            +
                  # Wraps ActionView::Helpers::FormHelper#month_field for form builders:
         | 
| 1832 | 
            +
                  #
         | 
| 1833 | 
            +
                  #   <%= form_with model: @user do |f| %>
         | 
| 1834 | 
            +
                  #     <%= f.month_field :birthday_month %>
         | 
| 1835 | 
            +
                  #   <% end %>
         | 
| 1836 | 
            +
                  #
         | 
| 1837 | 
            +
                  # Please refer to the documentation of the base helper for details.
         | 
| 1838 | 
            +
             | 
| 1839 | 
            +
                  ##
         | 
| 1840 | 
            +
                  # :method: week_field
         | 
| 1841 | 
            +
                  #
         | 
| 1842 | 
            +
                  # :call-seq: week_field(method, options = {})
         | 
| 1843 | 
            +
                  #
         | 
| 1844 | 
            +
                  # Wraps ActionView::Helpers::FormHelper#week_field for form builders:
         | 
| 1845 | 
            +
                  #
         | 
| 1846 | 
            +
                  #   <%= form_with model: @user do |f| %>
         | 
| 1847 | 
            +
                  #     <%= f.week_field :birthday_week %>
         | 
| 1848 | 
            +
                  #   <% end %>
         | 
| 1849 | 
            +
                  #
         | 
| 1850 | 
            +
                  # Please refer to the documentation of the base helper for details.
         | 
| 1851 | 
            +
             | 
| 1852 | 
            +
                  ##
         | 
| 1853 | 
            +
                  # :method: url_field
         | 
| 1854 | 
            +
                  #
         | 
| 1855 | 
            +
                  # :call-seq: url_field(method, options = {})
         | 
| 1856 | 
            +
                  #
         | 
| 1857 | 
            +
                  # Wraps ActionView::Helpers::FormHelper#url_field for form builders:
         | 
| 1858 | 
            +
                  #
         | 
| 1859 | 
            +
                  #   <%= form_with model: @user do |f| %>
         | 
| 1860 | 
            +
                  #     <%= f.url_field :homepage %>
         | 
| 1861 | 
            +
                  #   <% end %>
         | 
| 1862 | 
            +
                  #
         | 
| 1863 | 
            +
                  # Please refer to the documentation of the base helper for details.
         | 
| 1864 | 
            +
             | 
| 1865 | 
            +
                  ##
         | 
| 1866 | 
            +
                  # :method: email_field
         | 
| 1867 | 
            +
                  #
         | 
| 1868 | 
            +
                  # :call-seq: email_field(method, options = {})
         | 
| 1869 | 
            +
                  #
         | 
| 1870 | 
            +
                  # Wraps ActionView::Helpers::FormHelper#email_field for form builders:
         | 
| 1871 | 
            +
                  #
         | 
| 1872 | 
            +
                  #   <%= form_with model: @user do |f| %>
         | 
| 1873 | 
            +
                  #     <%= f.email_field :address %>
         | 
| 1874 | 
            +
                  #   <% end %>
         | 
| 1875 | 
            +
                  #
         | 
| 1876 | 
            +
                  # Please refer to the documentation of the base helper for details.
         | 
| 1877 | 
            +
             | 
| 1878 | 
            +
                  ##
         | 
| 1879 | 
            +
                  # :method: number_field
         | 
| 1880 | 
            +
                  #
         | 
| 1881 | 
            +
                  # :call-seq: number_field(method, options = {})
         | 
| 1882 | 
            +
                  #
         | 
| 1883 | 
            +
                  # Wraps ActionView::Helpers::FormHelper#number_field for form builders:
         | 
| 1884 | 
            +
                  #
         | 
| 1885 | 
            +
                  #   <%= form_with model: @user do |f| %>
         | 
| 1886 | 
            +
                  #     <%= f.number_field :age %>
         | 
| 1887 | 
            +
                  #   <% end %>
         | 
| 1888 | 
            +
                  #
         | 
| 1889 | 
            +
                  # Please refer to the documentation of the base helper for details.
         | 
| 1890 | 
            +
             | 
| 1891 | 
            +
                  ##
         | 
| 1892 | 
            +
                  # :method: range_field
         | 
| 1893 | 
            +
                  #
         | 
| 1894 | 
            +
                  # :call-seq: range_field(method, options = {})
         | 
| 1895 | 
            +
                  #
         | 
| 1896 | 
            +
                  # Wraps ActionView::Helpers::FormHelper#range_field for form builders:
         | 
| 1897 | 
            +
                  #
         | 
| 1898 | 
            +
                  #   <%= form_with model: @user do |f| %>
         | 
| 1899 | 
            +
                  #     <%= f.range_field :age %>
         | 
| 1900 | 
            +
                  #   <% end %>
         | 
| 1901 | 
            +
                  #
         | 
| 1902 | 
            +
                  # Please refer to the documentation of the base helper for details.
         | 
| 1903 | 
            +
             | 
| 1677 1904 | 
             
                  (field_helpers - [:label, :check_box, :radio_button, :fields_for, :fields, :hidden_field, :file_field]).each do |selector|
         | 
| 1678 1905 | 
             
                    class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1
         | 
| 1679 1906 | 
             
                      def #{selector}(method, options = {})  # def text_field(method, options = {})
         | 
| @@ -2247,7 +2474,7 @@ module ActionView | |
| 2247 2474 | 
             
                    @template.button_tag(value, options, &block)
         | 
| 2248 2475 | 
             
                  end
         | 
| 2249 2476 |  | 
| 2250 | 
            -
                  def emitted_hidden_id?
         | 
| 2477 | 
            +
                  def emitted_hidden_id? # :nodoc:
         | 
| 2251 2478 | 
             
                    @emitted_hidden_id ||= nil
         | 
| 2252 2479 | 
             
                  end
         | 
| 2253 2480 |  | 
| @@ -2267,7 +2494,12 @@ module ActionView | |
| 2267 2494 | 
             
                      end
         | 
| 2268 2495 |  | 
| 2269 2496 | 
             
                      defaults = []
         | 
| 2270 | 
            -
                       | 
| 2497 | 
            +
                      # Object is a model and it is not overwritten by as and scope option.
         | 
| 2498 | 
            +
                      if object.respond_to?(:model_name) && object_name.to_s == model.downcase
         | 
| 2499 | 
            +
                        defaults << :"helpers.submit.#{object.model_name.i18n_key}.#{key}"
         | 
| 2500 | 
            +
                      else
         | 
| 2501 | 
            +
                        defaults << :"helpers.submit.#{object_name}.#{key}"
         | 
| 2502 | 
            +
                      end
         | 
| 2271 2503 | 
             
                      defaults << :"helpers.submit.#{key}"
         | 
| 2272 2504 | 
             
                      defaults << "#{key.to_s.humanize} #{model}"
         | 
| 2273 2505 |  | 
| @@ -16,7 +16,7 @@ module ActionView | |
| 16 16 | 
             
                #
         | 
| 17 17 | 
             
                # * <tt>:include_blank</tt> - set to true or a prompt string if the first option element of the select element is a blank. Useful if there is not a default value required for the select element.
         | 
| 18 18 | 
             
                #
         | 
| 19 | 
            -
                #     select("post", "category", Post::CATEGORIES, {include_blank: true})
         | 
| 19 | 
            +
                #     select("post", "category", Post::CATEGORIES, { include_blank: true })
         | 
| 20 20 | 
             
                #
         | 
| 21 21 | 
             
                #   could become:
         | 
| 22 22 | 
             
                #
         | 
| @@ -30,7 +30,7 @@ module ActionView | |
| 30 30 | 
             
                #
         | 
| 31 31 | 
             
                #   Example with <tt>@post.person_id => 2</tt>:
         | 
| 32 32 | 
             
                #
         | 
| 33 | 
            -
                #     select("post", "person_id", Person.all.collect {|p| [ p.name, p.id ] }, {include_blank: 'None'})
         | 
| 33 | 
            +
                #     select("post", "person_id", Person.all.collect { |p| [ p.name, p.id ] }, { include_blank: 'None' })
         | 
| 34 34 | 
             
                #
         | 
| 35 35 | 
             
                #   could become:
         | 
| 36 36 | 
             
                #
         | 
| @@ -43,7 +43,7 @@ module ActionView | |
| 43 43 | 
             
                #
         | 
| 44 44 | 
             
                # * <tt>:prompt</tt> - set to true or a prompt string. When the select element doesn't have a value yet, this prepends an option with a generic prompt -- "Please select" -- or the given prompt string.
         | 
| 45 45 | 
             
                #
         | 
| 46 | 
            -
                #     select("post", "person_id", Person.all.collect {|p| [ p.name, p.id ] }, {prompt: 'Select Person'})
         | 
| 46 | 
            +
                #     select("post", "person_id", Person.all.collect { |p| [ p.name, p.id ] }, { prompt: 'Select Person' })
         | 
| 47 47 | 
             
                #
         | 
| 48 48 | 
             
                #   could become:
         | 
| 49 49 | 
             
                #
         | 
| @@ -69,7 +69,7 @@ module ActionView | |
| 69 69 | 
             
                #
         | 
| 70 70 | 
             
                # * <tt>:disabled</tt> - can be a single value or an array of values that will be disabled options in the final output.
         | 
| 71 71 | 
             
                #
         | 
| 72 | 
            -
                #     select("post", "category", Post::CATEGORIES, {disabled: 'restricted'})
         | 
| 72 | 
            +
                #     select("post", "category", Post::CATEGORIES, { disabled: 'restricted' })
         | 
| 73 73 | 
             
                #
         | 
| 74 74 | 
             
                #   could become:
         | 
| 75 75 | 
             
                #
         | 
| @@ -82,7 +82,7 @@ module ActionView | |
| 82 82 | 
             
                #
         | 
| 83 83 | 
             
                #   When used with the <tt>collection_select</tt> helper, <tt>:disabled</tt> can also be a Proc that identifies those options that should be disabled.
         | 
| 84 84 | 
             
                #
         | 
| 85 | 
            -
                #     collection_select(:post, :category_id, Category.all, :id, :name, {disabled: -> (category) { category.archived? }})
         | 
| 85 | 
            +
                #     collection_select(:post, :category_id, Category.all, :id, :name, { disabled: -> (category) { category.archived? } })
         | 
| 86 86 | 
             
                #
         | 
| 87 87 | 
             
                #   If the categories "2008 stuff" and "Christmas" return true when the method <tt>archived?</tt> is called, this would return:
         | 
| 88 88 | 
             
                #     <select name="post[category_id]" id="post_category_id">
         | 
| @@ -107,7 +107,7 @@ module ActionView | |
| 107 107 | 
             
                  #
         | 
| 108 108 | 
             
                  # For example:
         | 
| 109 109 | 
             
                  #
         | 
| 110 | 
            -
                  #   select("post", "person_id", Person.all.collect {|p| [ p.name, p.id ] }, { include_blank: true })
         | 
| 110 | 
            +
                  #   select("post", "person_id", Person.all.collect { |p| [ p.name, p.id ] }, { include_blank: true })
         | 
| 111 111 | 
             
                  #
         | 
| 112 112 | 
             
                  # would become:
         | 
| 113 113 | 
             
                  #
         | 
| @@ -323,12 +323,12 @@ module ActionView | |
| 323 323 | 
             
                  #
         | 
| 324 324 | 
             
                  # You can optionally provide HTML attributes as the last element of the array.
         | 
| 325 325 | 
             
                  #
         | 
| 326 | 
            -
                  #   options_for_select([ "Denmark", ["USA", {class: 'bold'}], "Sweden" ], ["USA", "Sweden"])
         | 
| 326 | 
            +
                  #   options_for_select([ "Denmark", ["USA", { class: 'bold' }], "Sweden" ], ["USA", "Sweden"])
         | 
| 327 327 | 
             
                  #   # => <option value="Denmark">Denmark</option>
         | 
| 328 328 | 
             
                  #   # => <option value="USA" class="bold" selected="selected">USA</option>
         | 
| 329 329 | 
             
                  #   # => <option value="Sweden" selected="selected">Sweden</option>
         | 
| 330 330 | 
             
                  #
         | 
| 331 | 
            -
                  #   options_for_select([["Dollar", "$", {class: "bold"}], ["Kroner", "DKK", {onclick: "alert('HI');"}]])
         | 
| 331 | 
            +
                  #   options_for_select([["Dollar", "$", { class: "bold" }], ["Kroner", "DKK", { onclick: "alert('HI');" }]])
         | 
| 332 332 | 
             
                  #   # => <option value="$" class="bold">Dollar</option>
         | 
| 333 333 | 
             
                  #   # => <option value="DKK" onclick="alert('HI');">Kroner</option>
         | 
| 334 334 | 
             
                  #
         | 
| @@ -463,7 +463,7 @@ module ActionView | |
| 463 463 | 
             
                      option_tags = options_from_collection_for_select(
         | 
| 464 464 | 
             
                        value_for_collection(group, group_method), option_key_method, option_value_method, selected_key)
         | 
| 465 465 |  | 
| 466 | 
            -
                      content_tag("optgroup" | 
| 466 | 
            +
                      content_tag("optgroup", option_tags, label: value_for_collection(group, group_label_method))
         | 
| 467 467 | 
             
                    end.join.html_safe
         | 
| 468 468 | 
             
                  end
         | 
| 469 469 |  | 
| @@ -535,7 +535,7 @@ module ActionView | |
| 535 535 | 
             
                    body = "".html_safe
         | 
| 536 536 |  | 
| 537 537 | 
             
                    if prompt
         | 
| 538 | 
            -
                      body.safe_concat content_tag("option" | 
| 538 | 
            +
                      body.safe_concat content_tag("option", prompt_text(prompt), value: "")
         | 
| 539 539 | 
             
                    end
         | 
| 540 540 |  | 
| 541 541 | 
             
                    grouped_options.each do |container|
         | 
| @@ -548,7 +548,7 @@ module ActionView | |
| 548 548 | 
             
                      end
         | 
| 549 549 |  | 
| 550 550 | 
             
                      html_attributes = { label: label }.merge!(html_attributes)
         | 
| 551 | 
            -
                      body.safe_concat content_tag("optgroup" | 
| 551 | 
            +
                      body.safe_concat content_tag("optgroup", options_for_select(container, selected_key), html_attributes)
         | 
| 552 552 | 
             
                    end
         | 
| 553 553 |  | 
| 554 554 | 
             
                    body
         | 
| @@ -566,9 +566,10 @@ module ActionView | |
| 566 566 | 
             
                  # an ActiveSupport::TimeZone.
         | 
| 567 567 | 
             
                  #
         | 
| 568 568 | 
             
                  # By default, +model+ is the ActiveSupport::TimeZone constant (which can
         | 
| 569 | 
            -
                  # be obtained in Active Record as a value object). The  | 
| 570 | 
            -
                  #  | 
| 571 | 
            -
                  #  | 
| 569 | 
            +
                  # be obtained in Active Record as a value object). The +model+ parameter
         | 
| 570 | 
            +
                  # must respond to +all+ and return an array of objects that represent time
         | 
| 571 | 
            +
                  # zones; each object must respond to +name+. If a Regexp is given it will
         | 
| 572 | 
            +
                  # attempt to match the zones using the <code>=~<code> operator.
         | 
| 572 573 | 
             
                  #
         | 
| 573 574 | 
             
                  # NOTE: Only the option tags are returned, you have to wrap this call in
         | 
| 574 575 | 
             
                  # a regular HTML select tag.
         | 
| @@ -584,7 +585,7 @@ module ActionView | |
| 584 585 | 
             
                      end
         | 
| 585 586 |  | 
| 586 587 | 
             
                      zone_options.safe_concat options_for_select(convert_zones[priority_zones], selected)
         | 
| 587 | 
            -
                      zone_options.safe_concat content_tag("option" | 
| 588 | 
            +
                      zone_options.safe_concat content_tag("option", "-------------", value: "", disabled: true)
         | 
| 588 589 | 
             
                      zone_options.safe_concat "\n"
         | 
| 589 590 |  | 
| 590 591 | 
             
                      zones = zones - priority_zones
         | 
| @@ -654,7 +655,7 @@ module ActionView | |
| 654 655 | 
             
                  #
         | 
| 655 656 | 
             
                  # ==== Gotcha
         | 
| 656 657 | 
             
                  #
         | 
| 657 | 
            -
                  # The HTML specification says when nothing is  | 
| 658 | 
            +
                  # The HTML specification says when nothing is selected on a collection of radio buttons
         | 
| 658 659 | 
             
                  # web browsers do not send any value to server.
         | 
| 659 660 | 
             
                  # Unfortunately this introduces a gotcha:
         | 
| 660 661 | 
             
                  # if a +User+ model has a +category_id+ field and in the form no category is selected, no +category_id+ parameter is sent. So,
         | 
| @@ -794,7 +795,7 @@ module ActionView | |
| 794 795 | 
             
                    def extract_values_from_collection(collection, value_method, selected)
         | 
| 795 796 | 
             
                      if selected.is_a?(Proc)
         | 
| 796 797 | 
             
                        collection.map do |element|
         | 
| 797 | 
            -
                          element | 
| 798 | 
            +
                          public_or_deprecated_send(element, value_method) if selected.call(element)
         | 
| 798 799 | 
             
                        end.compact
         | 
| 799 800 | 
             
                      else
         | 
| 800 801 | 
             
                        selected
         | 
| @@ -802,7 +803,15 @@ module ActionView | |
| 802 803 | 
             
                    end
         | 
| 803 804 |  | 
| 804 805 | 
             
                    def value_for_collection(item, value)
         | 
| 805 | 
            -
                      value.respond_to?(:call) ? value.call(item) : item | 
| 806 | 
            +
                      value.respond_to?(:call) ? value.call(item) : public_or_deprecated_send(item, value)
         | 
| 807 | 
            +
                    end
         | 
| 808 | 
            +
             | 
| 809 | 
            +
                    def public_or_deprecated_send(item, value)
         | 
| 810 | 
            +
                      item.public_send(value)
         | 
| 811 | 
            +
                    rescue NoMethodError
         | 
| 812 | 
            +
                      raise unless item.respond_to?(value, true) && !item.respond_to?(value)
         | 
| 813 | 
            +
                      ActiveSupport::Deprecation.warn "Using private methods from view helpers is deprecated (calling private #{item.class}##{value})"
         | 
| 814 | 
            +
                      item.send(value)
         | 
| 806 815 | 
             
                    end
         | 
| 807 816 |  | 
| 808 817 | 
             
                    def prompt_text(prompt)
         | 
| @@ -22,7 +22,9 @@ module ActionView | |
| 22 22 | 
             
                  mattr_accessor :embed_authenticity_token_in_remote_forms
         | 
| 23 23 | 
             
                  self.embed_authenticity_token_in_remote_forms = nil
         | 
| 24 24 |  | 
| 25 | 
            -
                   | 
| 25 | 
            +
                  mattr_accessor :default_enforce_utf8, default: true
         | 
| 26 | 
            +
             | 
| 27 | 
            +
                  # Starts a form tag that points the action to a URL configured with <tt>url_for_options</tt> just like
         | 
| 26 28 | 
             
                  # ActionController::Base#url_for. The method for the form defaults to POST.
         | 
| 27 29 | 
             
                  #
         | 
| 28 30 | 
             
                  # ==== Options
         | 
| @@ -135,7 +137,8 @@ module ActionView | |
| 135 137 | 
             
                    html_name = (options[:multiple] == true && !name.to_s.ends_with?("[]")) ? "#{name}[]" : name
         | 
| 136 138 |  | 
| 137 139 | 
             
                    if options.include?(:include_blank)
         | 
| 138 | 
            -
                      include_blank = options | 
| 140 | 
            +
                      include_blank = options[:include_blank]
         | 
| 141 | 
            +
                      options = options.except(:include_blank)
         | 
| 139 142 | 
             
                      options_for_blank_options_tag = { value: "" }
         | 
| 140 143 |  | 
| 141 144 | 
             
                      if include_blank == true
         | 
| @@ -144,15 +147,15 @@ module ActionView | |
| 144 147 | 
             
                      end
         | 
| 145 148 |  | 
| 146 149 | 
             
                      if include_blank
         | 
| 147 | 
            -
                        option_tags = content_tag("option" | 
| 150 | 
            +
                        option_tags = content_tag("option", include_blank, options_for_blank_options_tag).safe_concat(option_tags)
         | 
| 148 151 | 
             
                      end
         | 
| 149 152 | 
             
                    end
         | 
| 150 153 |  | 
| 151 154 | 
             
                    if prompt = options.delete(:prompt)
         | 
| 152 | 
            -
                      option_tags = content_tag("option" | 
| 155 | 
            +
                      option_tags = content_tag("option", prompt, value: "").safe_concat(option_tags)
         | 
| 153 156 | 
             
                    end
         | 
| 154 157 |  | 
| 155 | 
            -
                    content_tag "select" | 
| 158 | 
            +
                    content_tag "select", option_tags, { "name" => html_name, "id" => sanitize_to_id(name) }.update(options.stringify_keys)
         | 
| 156 159 | 
             
                  end
         | 
| 157 160 |  | 
| 158 161 | 
             
                  # Creates a standard text field; use these text fields to input smaller chunks of text like a username
         | 
| @@ -389,8 +392,8 @@ module ActionView | |
| 389 392 | 
             
                  # * Any other key creates standard HTML options for the tag.
         | 
| 390 393 | 
             
                  #
         | 
| 391 394 | 
             
                  # ==== Examples
         | 
| 392 | 
            -
                  #   radio_button_tag ' | 
| 393 | 
            -
                  #   # => <input id=" | 
| 395 | 
            +
                  #   radio_button_tag 'favorite_color', 'maroon'
         | 
| 396 | 
            +
                  #   # => <input id="favorite_color_maroon" name="favorite_color" type="radio" value="maroon" />
         | 
| 394 397 | 
             
                  #
         | 
| 395 398 | 
             
                  #   radio_button_tag 'receive_updates', 'no', true
         | 
| 396 399 | 
             
                  #   # => <input checked="checked" id="receive_updates_no" name="receive_updates" type="radio" value="no" />
         | 
| @@ -577,7 +580,7 @@ module ActionView | |
| 577 580 | 
             
                  #   # => <fieldset class="format"><p><input id="name" name="name" type="text" /></p></fieldset>
         | 
| 578 581 | 
             
                  def field_set_tag(legend = nil, options = nil, &block)
         | 
| 579 582 | 
             
                    output = tag(:fieldset, options, true)
         | 
| 580 | 
            -
                    output.safe_concat(content_tag("legend" | 
| 583 | 
            +
                    output.safe_concat(content_tag("legend", legend)) unless legend.blank?
         | 
| 581 584 | 
             
                    output.concat(capture(&block)) if block_given?
         | 
| 582 585 | 
             
                    output.safe_concat("</fieldset>")
         | 
| 583 586 | 
             
                  end
         | 
| @@ -869,7 +872,7 @@ module ActionView | |
| 869 872 | 
             
                          })
         | 
| 870 873 | 
             
                        end
         | 
| 871 874 |  | 
| 872 | 
            -
                      if html_options.delete("enforce_utf8") {  | 
| 875 | 
            +
                      if html_options.delete("enforce_utf8") { default_enforce_utf8 }
         | 
| 873 876 | 
             
                        utf8_enforcer_tag + method_tag
         | 
| 874 877 | 
             
                      else
         | 
| 875 878 | 
             
                        method_tag
         |