Module: Bento::Controllers::Helpers
- Defined in:
- lib/bento/controllers/helpers.rb
Constant Summary collapse
- @@resource_names =
[]
Class Method Summary collapse
Class Method Details
.define_helpers(resource_name) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/bento/controllers/helpers.rb', line 7 def self.define_helpers(resource_name) @@resource_names << resource_name.to_s.singularize ActiveSupport.on_load(:action_controller) do @@resource_names.uniq.each do |name| define_method("current_#{name}") do current_user.send(name) if current_user end helper_method "current_#{name}" end end end |