Class: Carbonyte::ApplicationPolicy
- Inherits:
-
Object
- Object
- Carbonyte::ApplicationPolicy
- Defined in:
- app/policies/carbonyte/application_policy.rb
Overview
Carbonyte base class for all policies
Defined Under Namespace
Classes: Scope
Instance Attribute Summary collapse
-
#record ⇒ Object
readonly
Returns the value of attribute record.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
-
#create? ⇒ Boolean
Can the user create a new record?.
-
#destroy? ⇒ Boolean
Can the user destroy this record?.
-
#index? ⇒ Boolean
Can the user get a list of records?.
-
#initialize(user, record) ⇒ ApplicationPolicy
constructor
Initializes a new policy with the current user and the record.
-
#show? ⇒ Boolean
Can the user get this specific record?.
-
#update? ⇒ Boolean
Can the user update this record?.
Constructor Details
#initialize(user, record) ⇒ ApplicationPolicy
Initializes a new policy with the current user and the record
9 10 11 12 |
# File 'app/policies/carbonyte/application_policy.rb', line 9 def initialize(user, record) @user = user @record = record end |
Instance Attribute Details
#record ⇒ Object (readonly)
Returns the value of attribute record.
6 7 8 |
# File 'app/policies/carbonyte/application_policy.rb', line 6 def record @record end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
6 7 8 |
# File 'app/policies/carbonyte/application_policy.rb', line 6 def user @user end |
Instance Method Details
#create? ⇒ Boolean
Can the user create a new record?
25 26 27 |
# File 'app/policies/carbonyte/application_policy.rb', line 25 def create? true end |
#destroy? ⇒ Boolean
Can the user destroy this record?
35 36 37 |
# File 'app/policies/carbonyte/application_policy.rb', line 35 def destroy? true end |
#index? ⇒ Boolean
Can the user get a list of records?
15 16 17 |
# File 'app/policies/carbonyte/application_policy.rb', line 15 def index? true end |
#show? ⇒ Boolean
Can the user get this specific record?
20 21 22 |
# File 'app/policies/carbonyte/application_policy.rb', line 20 def show? true end |
#update? ⇒ Boolean
Can the user update this record?
30 31 32 |
# File 'app/policies/carbonyte/application_policy.rb', line 30 def update? true end |