Class: NippoCore::ReportPolicy
- Inherits:
-
ApplicationPolicy
- Object
- ApplicationPolicy
- NippoCore::ReportPolicy
- Defined in:
- app/policies/nippo_core/report_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
- #create? ⇒ Boolean
-
#index? ⇒ Boolean
TODO: remove.
-
#initialize(user, report) ⇒ ReportPolicy
constructor
A new instance of ReportPolicy.
- #new? ⇒ Boolean
- #show? ⇒ Boolean
Methods inherited from ApplicationPolicy
#destroy?, #edit?, #scope, #update?
Constructor Details
#initialize(user, report) ⇒ ReportPolicy
Returns a new instance of ReportPolicy.
5 6 7 8 |
# File 'app/policies/nippo_core/report_policy.rb', line 5 def initialize(user, report) @user = user @group = report.group end |
Instance Attribute Details
#group ⇒ Object (readonly)
Returns the value of attribute group.
3 4 5 |
# File 'app/policies/nippo_core/report_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/report_policy.rb', line 3 def user @user end |
Instance Method Details
#create? ⇒ Boolean
23 24 25 |
# File 'app/policies/nippo_core/report_policy.rb', line 23 def create? @group.member?(user) end |
#index? ⇒ Boolean
TODO: remove
11 12 13 |
# File 'app/policies/nippo_core/report_policy.rb', line 11 def index? @group.member?(user) end |
#new? ⇒ Boolean
19 20 21 |
# File 'app/policies/nippo_core/report_policy.rb', line 19 def new? @group.member?(user) end |
#show? ⇒ Boolean
15 16 17 |
# File 'app/policies/nippo_core/report_policy.rb', line 15 def show? @group.member?(user) end |