Class: ApplicationPolicy
- Inherits:
-
Object
- Object
- ApplicationPolicy
- Defined in:
- lib/pineapples/templates/app/policies!=pundit!/application_policy.rb
Defined Under Namespace
Classes: Scope
Instance Attribute Summary collapse
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
-
#create? ⇒ Boolean
def show? scope.where(id: record.id).exists? end.
- #destroy? ⇒ Boolean
- #edit? ⇒ Boolean
- #index? ⇒ Boolean
-
#initialize(user, model) ⇒ ApplicationPolicy
constructor
A new instance of ApplicationPolicy.
- #new? ⇒ Boolean
- #update? ⇒ Boolean
Constructor Details
#initialize(user, model) ⇒ ApplicationPolicy
Returns a new instance of ApplicationPolicy.
4 5 6 |
# File 'lib/pineapples/templates/app/policies!=pundit!/application_policy.rb', line 4 def initialize(user, model) @user = user end |
Instance Attribute Details
#user ⇒ Object (readonly)
Returns the value of attribute user.
2 3 4 |
# File 'lib/pineapples/templates/app/policies!=pundit!/application_policy.rb', line 2 def user @user end |
Instance Method Details
#create? ⇒ Boolean
def show?
scope.where(id: record.id).exists?
end
16 17 18 |
# File 'lib/pineapples/templates/app/policies!=pundit!/application_policy.rb', line 16 def create? false end |
#destroy? ⇒ Boolean
32 33 34 |
# File 'lib/pineapples/templates/app/policies!=pundit!/application_policy.rb', line 32 def destroy? false end |
#edit? ⇒ Boolean
28 29 30 |
# File 'lib/pineapples/templates/app/policies!=pundit!/application_policy.rb', line 28 def edit? update? end |
#index? ⇒ Boolean
8 9 10 |
# File 'lib/pineapples/templates/app/policies!=pundit!/application_policy.rb', line 8 def index? false end |
#new? ⇒ Boolean
20 21 22 |
# File 'lib/pineapples/templates/app/policies!=pundit!/application_policy.rb', line 20 def new? create? end |
#update? ⇒ Boolean
24 25 26 |
# File 'lib/pineapples/templates/app/policies!=pundit!/application_policy.rb', line 24 def update? false end |