instance method
helper_attr
Ruby on Rails 3.0.20
Since v2.2.3Signature
helper_attr(*attrs)
Declares helper accessors for controller attributes. For example, the following adds new name and name= instance methods to a controller and makes them available to the view:
helper_attr :name attr_accessor :name
Parameters
- *attrs<Array[String, Symbol]>
-
Names of attributes to be converted
into helpers.
Parameters
-
attrsrest
Source
# File actionpack/lib/action_controller/metal/helpers.rb, line 80
def helper_attr(*attrs)
attrs.flatten.each { |attr| helper_method(attr, "#{attr}=") }
end
Defined in actionpack/lib/action_controller/metal/helpers.rb line 80
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActionController::Helpers::ClassMethods