diff options
Diffstat (limited to 'actionpack/lib/action_view')
-rw-r--r-- | actionpack/lib/action_view/helpers/form_helper.rb | 21 | ||||
-rw-r--r-- | actionpack/lib/action_view/helpers/form_tag_helper.rb | 4 |
2 files changed, 5 insertions, 20 deletions
diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb index 1d91b6957a..4d29a03b92 100644 --- a/actionpack/lib/action_view/helpers/form_helper.rb +++ b/actionpack/lib/action_view/helpers/form_helper.rb @@ -528,7 +528,7 @@ module ActionView object_name = ActionController::RecordIdentifier.singular_class_name(object) end - builder = options[:builder] || ActionView.default_form_builder + builder = options[:builder] || ActionView::Base.default_form_builder yield builder.new(object_name, object, self, options, block) end @@ -1208,21 +1208,8 @@ module ActionView end end - class << ActionView - attr_accessor :default_form_builder + class Base + cattr_accessor :default_form_builder + @@default_form_builder = ::ActionView::Helpers::FormBuilder end - - self.default_form_builder = ::ActionView::Helpers::FormBuilder - - # 2.3 compatibility - class << Base - def default_form_builder=(builder) - ActionView.default_form_builder = builder - end - - def default_form_builder - ActionView.default_form_builder - end - end - end diff --git a/actionpack/lib/action_view/helpers/form_tag_helper.rb b/actionpack/lib/action_view/helpers/form_tag_helper.rb index 9b8471c6c6..ba1b0bcc20 100644 --- a/actionpack/lib/action_view/helpers/form_tag_helper.rb +++ b/actionpack/lib/action_view/helpers/form_tag_helper.rb @@ -329,9 +329,7 @@ module ActionView # radio_button_tag 'color', "green", true, :class => "color_input" # # => <input checked="checked" class="color_input" id="color_green" name="color" type="radio" value="green" /> def radio_button_tag(name, value, checked = false, options = {}) - pretty_tag_value = value.to_s.gsub(/\s/, "_").gsub(/(?!-)\W/, "").downcase - pretty_name = name.to_s.gsub(/\[/, "_").gsub(/\]/, "") - html_options = { "type" => "radio", "name" => name, "id" => "#{pretty_name}_#{pretty_tag_value}", "value" => value }.update(options.stringify_keys) + html_options = { "type" => "radio", "name" => name, "id" => "#{sanitize_to_id(name)}_#{sanitize_to_id(value)}", "value" => value }.update(options.stringify_keys) html_options["checked"] = "checked" if checked tag :input, html_options end |