Class: ActionAuthorization::BasePolicy
- Inherits:
-
Object
- Object
- ActionAuthorization::BasePolicy
- Defined in:
- lib/action_authorization/base_policy.rb
Instance Attribute Summary collapse
-
#object ⇒ Object
Returns the value of attribute object.
-
#user ⇒ Object
Returns the value of attribute user.
Class Method Summary collapse
-
.inherited(klass) ⇒ Object
create alias to object from subclass name.
Instance Method Summary collapse
- #create? ⇒ Boolean
- #destroy? ⇒ Boolean
- #edit? ⇒ Boolean
- #index? ⇒ Boolean
-
#initialize(user, object) ⇒ BasePolicy
constructor
A new instance of BasePolicy.
- #new? ⇒ Boolean
- #show? ⇒ Boolean
- #update? ⇒ Boolean
Constructor Details
#initialize(user, object) ⇒ BasePolicy
Returns a new instance of BasePolicy.
5 6 7 8 |
# File 'lib/action_authorization/base_policy.rb', line 5 def initialize(user, object) self.user = user self.object = object end |
Instance Attribute Details
#object ⇒ Object
Returns the value of attribute object.
3 4 5 |
# File 'lib/action_authorization/base_policy.rb', line 3 def object @object end |
#user ⇒ Object
Returns the value of attribute user.
3 4 5 |
# File 'lib/action_authorization/base_policy.rb', line 3 def user @user end |
Class Method Details
.inherited(klass) ⇒ Object
create alias to object from subclass name
11 12 13 |
# File 'lib/action_authorization/base_policy.rb', line 11 def self.inherited(klass) klass.send(:alias_method, klass.name.gsub('Policy', '').underscore, :object) end |
Instance Method Details
#create? ⇒ Boolean
27 28 29 |
# File 'lib/action_authorization/base_policy.rb', line 27 def create? end |
#destroy? ⇒ Boolean
39 40 41 |
# File 'lib/action_authorization/base_policy.rb', line 39 def destroy? create? end |
#edit? ⇒ Boolean
31 32 33 |
# File 'lib/action_authorization/base_policy.rb', line 31 def edit? update? end |
#index? ⇒ Boolean
15 16 17 |
# File 'lib/action_authorization/base_policy.rb', line 15 def index? end |
#new? ⇒ Boolean
23 24 25 |
# File 'lib/action_authorization/base_policy.rb', line 23 def new? create? end |
#show? ⇒ Boolean
19 20 21 |
# File 'lib/action_authorization/base_policy.rb', line 19 def show? end |
#update? ⇒ Boolean
35 36 37 |
# File 'lib/action_authorization/base_policy.rb', line 35 def update? end |