Class: Cortex::ContentItemPolicy
- Inherits:
-
Object
- Object
- Cortex::ContentItemPolicy
- Defined in:
- app/policies/cortex/content_item_policy.rb
Instance Attribute Summary collapse
-
#content_item ⇒ Object
readonly
Returns the value of attribute content_item.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
- #can_publish? ⇒ Boolean
- #create? ⇒ Boolean
- #destroy? ⇒ Boolean
- #edit? ⇒ Boolean
- #index? ⇒ Boolean
-
#initialize(user, content_item) ⇒ ContentItemPolicy
constructor
A new instance of ContentItemPolicy.
- #new? ⇒ Boolean
- #show? ⇒ Boolean
- #update? ⇒ Boolean
Constructor Details
#initialize(user, content_item) ⇒ ContentItemPolicy
Returns a new instance of ContentItemPolicy.
5 6 7 8 9 |
# File 'app/policies/cortex/content_item_policy.rb', line 5 def initialize(user, content_item) @user = user @content_item = content_item @content_type = @content_item.content_type end |
Instance Attribute Details
#content_item ⇒ Object (readonly)
Returns the value of attribute content_item.
3 4 5 |
# File 'app/policies/cortex/content_item_policy.rb', line 3 def content_item @content_item end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
3 4 5 |
# File 'app/policies/cortex/content_item_policy.rb', line 3 def user @user end |
Instance Method Details
#can_publish? ⇒ Boolean
39 40 41 |
# File 'app/policies/cortex/content_item_policy.rb', line 39 def can_publish? ("Publish") end |
#create? ⇒ Boolean
19 20 21 |
# File 'app/policies/cortex/content_item_policy.rb', line 19 def create? ("Create") end |
#destroy? ⇒ Boolean
35 36 37 |
# File 'app/policies/cortex/content_item_policy.rb', line 35 def destroy? ("Destroy") end |
#edit? ⇒ Boolean
31 32 33 |
# File 'app/policies/cortex/content_item_policy.rb', line 31 def edit? ("Edit") end |
#index? ⇒ Boolean
11 12 13 |
# File 'app/policies/cortex/content_item_policy.rb', line 11 def index? ("Index") end |
#new? ⇒ Boolean
23 24 25 |
# File 'app/policies/cortex/content_item_policy.rb', line 23 def new? ("New") end |
#show? ⇒ Boolean
15 16 17 |
# File 'app/policies/cortex/content_item_policy.rb', line 15 def show? ("Show") end |
#update? ⇒ Boolean
27 28 29 |
# File 'app/policies/cortex/content_item_policy.rb', line 27 def update? ("Update") end |