diff options
Diffstat (limited to 'actionpack/lib/action_view')
-rw-r--r-- | actionpack/lib/action_view/helpers/form_helper.rb | 2 | ||||
-rw-r--r-- | actionpack/lib/action_view/helpers/tags.rb | 1 | ||||
-rw-r--r-- | actionpack/lib/action_view/helpers/tags/hidden_field.rb | 12 |
3 files changed, 14 insertions, 1 deletions
diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb index 87674cc2d0..1fbd3f80e6 100644 --- a/actionpack/lib/action_view/helpers/form_helper.rb +++ b/actionpack/lib/action_view/helpers/form_helper.rb @@ -717,7 +717,7 @@ module ActionView # hidden_field(:user, :token) # # => <input type="hidden" id="user_token" name="user[token]" value="#{@user.token}" /> def hidden_field(object_name, method, options = {}) - InstanceTag.new(object_name, method, self, options.delete(:object)).to_input_field_tag("hidden", options) + ActionView::Helpers::Tags::HiddenField.new(object_name, method, self, options).render end # Returns a file upload input tag tailored for accessing a specified attribute (identified by +method+) on an object diff --git a/actionpack/lib/action_view/helpers/tags.rb b/actionpack/lib/action_view/helpers/tags.rb index 036fb1efd8..b663f8b68f 100644 --- a/actionpack/lib/action_view/helpers/tags.rb +++ b/actionpack/lib/action_view/helpers/tags.rb @@ -5,6 +5,7 @@ module ActionView autoload :Label, 'action_view/helpers/tags/label' autoload :TextField, 'action_view/helpers/tags/text_field' autoload :PasswordField, 'action_view/helpers/tags/password_field' + autoload :HiddenField, 'action_view/helpers/tags/hidden_field' end end end diff --git a/actionpack/lib/action_view/helpers/tags/hidden_field.rb b/actionpack/lib/action_view/helpers/tags/hidden_field.rb new file mode 100644 index 0000000000..ea86596e0b --- /dev/null +++ b/actionpack/lib/action_view/helpers/tags/hidden_field.rb @@ -0,0 +1,12 @@ +module ActionView + module Helpers + module Tags + class HiddenField < TextField #:nodoc: + def render + @options.update(:size => nil) + super + end + end + end + end +end |