Module: TinyCore::Role::ClassMethods
- Defined in:
- lib/tiny_core/role.rb
Instance Method Summary collapse
Instance Method Details
#allow(*things) ⇒ Object
4 5 6 7 8 9 10 |
# File 'lib/tiny_core/role.rb', line 4 def allow(*things) things.each do |thing| define_method "can_#{thing}?" do true end end end |
#allow_if_owner(*things) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/tiny_core/role.rb', line 12 def allow_if_owner(*things) things.each do |thing| define_method "can_#{thing}?" do |model| model.user == self end end end |