aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/helpers/form_helper.rb
diff options
context:
space:
mode:
authorYehuda Katz <wycats@gmail.com>2009-07-20 00:27:04 +0900
committerYehuda Katz <wycats@gmail.com>2009-07-20 00:27:04 +0900
commit5ffaaa71d149c9807260c950c9a61d01fe734827 (patch)
treeb014dcbe7cc8efabebca38e9e75648905e85017e /actionpack/lib/action_view/helpers/form_helper.rb
parent45d41d8012c605f21de51e7018fa31e1d07776eb (diff)
downloadrails-5ffaaa71d149c9807260c950c9a61d01fe734827.tar.gz
rails-5ffaaa71d149c9807260c950c9a61d01fe734827.tar.bz2
rails-5ffaaa71d149c9807260c950c9a61d01fe734827.zip
Define ActiveModel API Compliance
- Define to_model on AR - Define to_model on ActiveModel::APICompliant - Update test fixtures to be API Compliant - Start using to_model in AP
Diffstat (limited to 'actionpack/lib/action_view/helpers/form_helper.rb')
-rw-r--r--actionpack/lib/action_view/helpers/form_helper.rb13
1 files changed, 9 insertions, 4 deletions
diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb
index a74709e98a..ecbdcd8e7a 100644
--- a/actionpack/lib/action_view/helpers/form_helper.rb
+++ b/actionpack/lib/action_view/helpers/form_helper.rb
@@ -626,8 +626,8 @@ module ActionView
# Returns a checkbox tag tailored for accessing a specified attribute (identified by +method+) on an object
# assigned to the template (identified by +object+). This object must be an instance object (@object) and not a local object.
- # It's intended that +method+ returns an integer and if that integer is above zero, then the checkbox is checked.
- # Additional options on the input tag can be passed as a hash with +options+. The +checked_value+ defaults to 1
+ # It's intended that +method+ returns an integer and if that integer is above zero, then the checkbox is checked.
+ # Additional options on the input tag can be passed as a hash with +options+. The +checked_value+ defaults to 1
# while the default +unchecked_value+ is set to 0 which is convenient for boolean values.
#
# ==== Gotcha
@@ -709,7 +709,8 @@ module ActionView
end
end
- class InstanceTag #:nodoc:
+ module InstanceTagMethods #:nodoc:
+ extend ActiveSupport::Concern
include Helpers::TagHelper, Helpers::FormTagHelper
attr_reader :method_name, :object_name
@@ -832,7 +833,7 @@ module ActionView
self.class.value_before_type_cast(object, @method_name)
end
- class << self
+ module ClassMethods
def value(object, method_name)
object.send method_name unless object.nil?
end
@@ -918,6 +919,10 @@ module ActionView
end
end
+ class InstanceTag
+ include InstanceTagMethods
+ end
+
class FormBuilder #:nodoc:
# The methods which wrap a form helper call.
class_inheritable_accessor :field_helpers