Module: Strongbolt::Bolted::InstanceMethods
- Defined in:
- lib/strongbolt/bolted.rb
Instance Method Summary collapse
-
#accessible?(action, attrs = :any) ⇒ Boolean
Asks permission to performa an operation on the current instance.
-
#strongbolt_owner_id ⇒ Object
Returns the owner id according to what’s.
Instance Method Details
#accessible?(action, attrs = :any) ⇒ Boolean
Asks permission to performa an operation on the current instance
82 83 84 |
# File 'lib/strongbolt/bolted.rb', line 82 def accessible?(action, attrs = :any) unbolted? || Grant::User.current_user.can?(action, self, attrs) end |
#strongbolt_owner_id ⇒ Object
Returns the owner id according to what’s
89 90 91 92 93 |
# File 'lib/strongbolt/bolted.rb', line 89 def strongbolt_owner_id raise ModelNotOwned unless self.class.owned? send self.class.owner_attribute end |