Module: ActionController::Helpers::ClassMethods
- Defined in:
 - actionpack/lib/action_controller/metal/helpers.rb
 
Instance Method Summary collapse
- 
  
    
      #helper_attr(*attrs)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
Declares helper accessors for controller attributes.
 - 
  
    
      #helpers  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
Provides a proxy to access helper methods from outside the view.
 - 
  
    
      #modules_for_helpers(args)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
Override modules_for_helpers to accept ‘:all` as argument, which loads all helpers in helpers_path.
 
Instance Method Details
#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 'actionpack/lib/action_controller/metal/helpers.rb', line 84 def helper_attr(*attrs) attrs.flatten.each { |attr| helper_method(attr, "#{attr}=") } end  | 
  
#helpers ⇒ Object
Provides a proxy to access helper methods from outside the view.
Note that the proxy is rendered under a different view context. This may cause incorrect behavior with capture methods. Consider using [helper](AbstractController::Helpers::ClassMethods#helper) instead when using ‘capture`.
      94 95 96 97 98 99 100  | 
    
      # File 'actionpack/lib/action_controller/metal/helpers.rb', line 94 def helpers @helper_proxy ||= begin proxy = ActionView::Base.empty proxy.config = config.inheritable_copy proxy.extend(_helpers) end end  | 
  
#modules_for_helpers(args) ⇒ Object
Override modules_for_helpers to accept ‘:all` as argument, which loads all helpers in helpers_path.
#### Parameters
- 
‘args` - A list of helpers
 
#### Returns
- 
‘array` - A normalized list of modules for the list of helpers provided.
 
      112 113 114 115  | 
    
      # File 'actionpack/lib/action_controller/metal/helpers.rb', line 112 def modules_for_helpers(args) args += all_application_helpers if args.delete(:all) super(args) end  |