diff options
author | Joshua Peek <josh@joshpeek.com> | 2009-11-16 21:03:27 -0600 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2009-11-16 21:03:27 -0600 |
commit | f8877d4b2a2a6f68770b376f0b1391a6295f62f2 (patch) | |
tree | 16f55b25c0055cf1dc9d1f6d354bce8541d87bda /actionpack/lib | |
parent | c2997017f79321a8d90af84b1de35f87e3dd2445 (diff) | |
parent | 7fadb3f261fc7cc753d303d0fbe2cbf019385f99 (diff) | |
download | rails-f8877d4b2a2a6f68770b376f0b1391a6295f62f2.tar.gz rails-f8877d4b2a2a6f68770b376f0b1391a6295f62f2.tar.bz2 rails-f8877d4b2a2a6f68770b376f0b1391a6295f62f2.zip |
Merge remote branch 'Fingertips/master'
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_view/helpers/form_helper.rb | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb index c46b39fc23..d0c66eda60 100644 --- a/actionpack/lib/action_view/helpers/form_helper.rb +++ b/actionpack/lib/action_view/helpers/form_helper.rb @@ -963,7 +963,7 @@ module ActionView end end - (field_helpers - %w(label check_box radio_button fields_for)).each do |selector| + (field_helpers - %w(label check_box radio_button fields_for hidden_field)).each do |selector| src = <<-end_src def #{selector}(method, options = {}) # def text_field(method, options = {}) @template.send( # @template.send( @@ -1022,6 +1022,11 @@ module ActionView def radio_button(method, tag_value, options = {}) @template.radio_button(@object_name, method, tag_value, objectify_options(options)) end + + def hidden_field(method, options = {}) + @emitted_hidden_id = true if method == :id + @template.hidden_field(@object_name, method, objectify_options(options)) + end def error_message_on(method, *args) @template.error_message_on(@object, method, *args) @@ -1035,6 +1040,10 @@ module ActionView @template.submit_tag(value, options.reverse_merge(:id => "#{object_name}_submit")) end + def emitted_hidden_id? + @emitted_hidden_id + end + private def objectify_options(options) @default_options.merge(options.merge(:object => @object)) @@ -1069,8 +1078,8 @@ module ActionView @template.fields_for(name, object, *args, &block) else @template.fields_for(name, object, *args) do |builder| - @template.concat builder.hidden_field(:id) block.call(builder) + @template.concat builder.hidden_field(:id) unless builder.emitted_hidden_id? end end end |