Module: Strongbolt::Bolted::InstanceMethods

Defined in:
lib/strongbolt/bolted.rb

Instance Method Summary collapse

Instance Method Details

#accessible?(action, attrs = :any) ⇒ Boolean

Asks permission to performa an operation on the current instance

Returns:

  • (Boolean)


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_idObject

Returns the owner id according to what’s

Raises:



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