aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/helpers
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@plataformatec.com.br>2012-02-02 03:38:13 -0800
committerJosé Valim <jose.valim@plataformatec.com.br>2012-02-02 03:38:13 -0800
commit3ccbc619e4e1614c94d19cc9d12bbe7f7826cbdf (patch)
treeb165ff3ec49f2215f205bdc8abafbe3eb6d3949b /actionpack/lib/action_view/helpers
parent593fe4312fc15fba458cf14e1154eeb8a8ded37c (diff)
parent3d1095563c7d6f3e32bddbf9008607d921061e58 (diff)
downloadrails-3ccbc619e4e1614c94d19cc9d12bbe7f7826cbdf.tar.gz
rails-3ccbc619e4e1614c94d19cc9d12bbe7f7826cbdf.tar.bz2
rails-3ccbc619e4e1614c94d19cc9d12bbe7f7826cbdf.zip
Merge pull request #4849 from carlosantoniodasilva/checkbox-hidden-form
Replicate :form html5 attribute to hidden field for check_box
Diffstat (limited to 'actionpack/lib/action_view/helpers')
-rw-r--r--actionpack/lib/action_view/helpers/tags/check_box.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/actionpack/lib/action_view/helpers/tags/check_box.rb b/actionpack/lib/action_view/helpers/tags/check_box.rb
index 7ad5de0596..579cdb9fc9 100644
--- a/actionpack/lib/action_view/helpers/tags/check_box.rb
+++ b/actionpack/lib/action_view/helpers/tags/check_box.rb
@@ -25,7 +25,7 @@ module ActionView
add_default_name_and_id(options)
end
- hidden = @unchecked_value ? tag("input", "name" => options["name"], "type" => "hidden", "value" => @unchecked_value, "disabled" => options["disabled"]) : "".html_safe
+ hidden = hidden_field_for_checkbox(options)
checkbox = tag("input", options)
hidden + checkbox
end
@@ -48,6 +48,10 @@ module ActionView
value.to_i != 0
end
end
+
+ def hidden_field_for_checkbox(options)
+ @unchecked_value ? tag("input", options.slice("name", "disabled", "form").merge!("type" => "hidden", "value" => @unchecked_value)) : "".html_safe
+ end
end
end
end