From b0cc858dd71576011c6f2a3995457c070d8b55d5 Mon Sep 17 00:00:00 2001 From: claudiob Date: Fri, 26 Sep 2014 20:11:39 -0700 Subject: Add `:enforce_utf8` option to form_for Since 06388b0 `form_tag` accepts the option `enforce_utf8` which, when set to false, prevents the hidden "UTF8 enforcer" field from appearing in the output. This commit implements the same behavior for `form_for`. Stems from https://github.com/rails/rails/pull/17685#issuecomment-63871395 --- actionview/lib/action_view/helpers/form_helper.rb | 3 +++ 1 file changed, 3 insertions(+) (limited to 'actionview/lib/action_view/helpers/form_helper.rb') diff --git a/actionview/lib/action_view/helpers/form_helper.rb b/actionview/lib/action_view/helpers/form_helper.rb index 03f80ff360..2119ea938f 100644 --- a/actionview/lib/action_view/helpers/form_helper.rb +++ b/actionview/lib/action_view/helpers/form_helper.rb @@ -164,6 +164,8 @@ module ActionView # * :namespace - A namespace for your form to ensure uniqueness of # id attributes on form elements. The namespace attribute will be prefixed # with underscore on the generated HTML id. + # * :enforce_utf8 - If set to false, a hidden input with name + # utf8 is not output. # * :html - Optional HTML attributes for the form tag. # # Also note that +form_for+ doesn't create an exclusive scope. It's still @@ -420,6 +422,7 @@ module ActionView html_options[:data] = options.delete(:data) if options.has_key?(:data) html_options[:remote] = options.delete(:remote) if options.has_key?(:remote) html_options[:method] = options.delete(:method) if options.has_key?(:method) + html_options[:enforce_utf8] = options.delete(:enforce_utf8) if options.has_key?(:enforce_utf8) html_options[:authenticity_token] = options.delete(:authenticity_token) builder = instantiate_builder(object_name, object, options) -- cgit v1.2.3