Module: Hai::Policies::ClassMethods
- Defined in:
- lib/hai/policies.rb
Instance Method Summary collapse
- #policies ⇒ Object
-
#policy(action, &block) ⇒ Object
TODO: validate CRUD actions.
Instance Method Details
#policies ⇒ Object
14 15 16 |
# File 'lib/hai/policies.rb', line 14 def policies @policies ||= {} end |
#policy(action, &block) ⇒ Object
TODO: validate CRUD actions
19 20 21 22 23 |
# File 'lib/hai/policies.rb', line 19 def policy(action, &block) policies[action] = lambda do |instance, context| block.call(instance, context) end end |