aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/helpers/tags/base.rb
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2012-01-16 21:17:33 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2012-01-17 00:05:29 -0300
commit675fb8defdbfdabdd57298b760e701b0b5c74e48 (patch)
tree588cdafe9e895b4d897d31ae9ed60723fa2f688c /actionpack/lib/action_view/helpers/tags/base.rb
parentd6b9eb9b4417f1f8705284e520b796466a690ed6 (diff)
downloadrails-675fb8defdbfdabdd57298b760e701b0b5c74e48.tar.gz
rails-675fb8defdbfdabdd57298b760e701b0b5c74e48.tar.bz2
rails-675fb8defdbfdabdd57298b760e701b0b5c74e48.zip
Remove code duplication between CheckBox ans RadioButton
Diffstat (limited to 'actionpack/lib/action_view/helpers/tags/base.rb')
-rw-r--r--actionpack/lib/action_view/helpers/tags/base.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/actionpack/lib/action_view/helpers/tags/base.rb b/actionpack/lib/action_view/helpers/tags/base.rb
index c50c7716d4..9f026f69b1 100644
--- a/actionpack/lib/action_view/helpers/tags/base.rb
+++ b/actionpack/lib/action_view/helpers/tags/base.rb
@@ -47,6 +47,15 @@ module ActionView
nil
end
+ def input_checked?(object, options)
+ if options.has_key?("checked")
+ checked = options.delete "checked"
+ checked == true || checked == "checked"
+ else
+ checked?(value(object))
+ end
+ end
+
def retrieve_autoindex(pre_match)
object = self.object || @template_object.instance_variable_get("@#{pre_match}")
if object && object.respond_to?(:to_param)