diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-01-16 20:02:39 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-01-17 00:05:28 -0300 |
commit | 6aeb799866ae08a0e8944cc23a48f1616b60d560 (patch) | |
tree | f5835dd3f9332f6ded3b0e0378304d796870b458 /actionpack | |
parent | 7cc373e4a052b1e90a916f7cae930a3da6613625 (diff) | |
download | rails-6aeb799866ae08a0e8944cc23a48f1616b60d560.tar.gz rails-6aeb799866ae08a0e8944cc23a48f1616b60d560.tar.bz2 rails-6aeb799866ae08a0e8944cc23a48f1616b60d560.zip |
Extract HiddenField
Diffstat (limited to 'actionpack')
-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 |