Class: NippoCore::GroupPolicy
- Inherits:
-
ApplicationPolicy
- Object
- ApplicationPolicy
- NippoCore::GroupPolicy
- Defined in:
- app/policies/nippo_core/group_policy.rb
Instance Attribute Summary collapse
-
#group ⇒ Object
readonly
Returns the value of attribute group.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Attributes inherited from ApplicationPolicy
Instance Method Summary collapse
- #edit? ⇒ Boolean
-
#initialize(user, group) ⇒ GroupPolicy
constructor
A new instance of GroupPolicy.
- #update? ⇒ Boolean
Methods inherited from ApplicationPolicy
#create?, #destroy?, #index?, #new?, #scope, #show?
Constructor Details
#initialize(user, group) ⇒ GroupPolicy
Returns a new instance of GroupPolicy.
5 6 7 8 |
# File 'app/policies/nippo_core/group_policy.rb', line 5 def initialize(user, group) @user = user @group = group end |
Instance Attribute Details
#group ⇒ Object (readonly)
Returns the value of attribute group.
3 4 5 |
# File 'app/policies/nippo_core/group_policy.rb', line 3 def group @group end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
3 4 5 |
# File 'app/policies/nippo_core/group_policy.rb', line 3 def user @user end |
Instance Method Details
#edit? ⇒ Boolean
10 11 12 |
# File 'app/policies/nippo_core/group_policy.rb', line 10 def edit? @group.member?(user) end |
#update? ⇒ Boolean
14 15 16 |
# File 'app/policies/nippo_core/group_policy.rb', line 14 def update? @group.member?(user) end |