Method: ActionController::Helpers::ClassMethods#helper_attr
- Defined in:
- lib/action_controller/metal/helpers.rb
#helper_attr(*attrs) ⇒ Object
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:
attr_accessor :name
helper_attr :name
#### Parameters
-
attrs- Names of attributes to be converted into helpers.
84 85 86 |
# File 'lib/action_controller/metal/helpers.rb', line 84 def helper_attr(*attrs) attrs.flatten.each { |attr| helper_method(attr, "#{attr}=") } end |