# File lib/action_controller/metal/helpers.rb, line 95 95: def all_helpers_from_path(path) 96: helpers = [] 97: Array.wrap(path).each do |_path| 98: extract = /^#{Regexp.quote(_path.to_s)}\/?(.*)_helper.rb$/ 99: helpers += Dir["#{_path}/**/*_helper.rb"].map { |file| file.sub(extract, '\1') } 100: end 101: helpers.sort! 102: helpers.uniq! 103: helpers 104: end
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
attrs - Names of attributes to be converted into helpers.
# File lib/action_controller/metal/helpers.rb, line 73 73: def helper_attr(*attrs) 74: attrs.flatten.each { |attr| helper_method(attr, "#{attr}=") } 75: end
Provides a proxy to access helpers methods from outside the view.
# File lib/action_controller/metal/helpers.rb, line 78 78: def helpers 79: @helper_proxy ||= ActionView::Base.new.extend(_helpers) 80: end
Overwrite modules_for_helpers to accept :all as argument, which loads all helpers in helpers_path.
args - A list of helpers
array - A normalized list of modules for the list of helpers provided.
# File lib/action_controller/metal/helpers.rb, line 90 90: def modules_for_helpers(args) 91: args += all_application_helpers if args.delete(:all) 92: super(args) 93: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.