Class Index [+]

Quicksearch

ActionController::Helpers::ClassMethods

Public Instance Methods

helper_attr(*attrs) click to toggle source

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

Names of attributes to be converted

  into helpers.
    # File lib/action_controller/metal/helpers.rb, line 80
80:       def helper_attr(*attrs)
81:         attrs.flatten.each { |attr| helper_method(attr, "#{attr}=") }
82:       end
helpers() click to toggle source

Provides a proxy to access helpers methods from outside the view.

    # File lib/action_controller/metal/helpers.rb, line 85
85:       def helpers
86:         @helper_proxy ||= ActionView::Base.new.extend(_helpers)
87:       end
helpers_dir() click to toggle source
    # File lib/action_controller/metal/helpers.rb, line 61
61:       def helpers_dir
62:         ActiveSupport::Deprecation.warn "helpers_dir is deprecated, use helpers_path instead", caller
63:         self.helpers_path
64:       end
helpers_dir=(value) click to toggle source
    # File lib/action_controller/metal/helpers.rb, line 66
66:       def helpers_dir=(value)
67:         ActiveSupport::Deprecation.warn "helpers_dir= is deprecated, use helpers_path= instead", caller
68:         self.helpers_path = Array.wrap(value)
69:       end

Private Instance Methods

all_application_helpers() click to toggle source

Extract helper names from files in app/helpers/**/*_helper.rb

     # File lib/action_controller/metal/helpers.rb, line 105
105:         def all_application_helpers
106:           helpers = []
107:           Array.wrap(helpers_path).each do |path|
108:             extract  = /^#{Regexp.quote(path.to_s)}\/?(.*)_helper.rb$/
109:             helpers += Dir["#{path}/**/*_helper.rb"].map { |file| file.sub(extract, '\1') }
110:           end
111:           helpers.sort!
112:           helpers.uniq!
113:           helpers
114:         end
modules_for_helpers(args) click to toggle source

Overwrite modules_for_helpers to accept :all as argument, which loads all helpers in helpers_dir.

Parameters

args

A list of helpers

Returns

Array[Module]

A normalized list of modules for the list of

  helpers provided.
     # File lib/action_controller/metal/helpers.rb, line 99
 99:         def modules_for_helpers(args)
100:           args += all_application_helpers if args.delete(:all)
101:           super(args)
102:         end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.