Class: Glib::ApplicationPolicy
- Inherits:
-
Object
- Object
- Glib::ApplicationPolicy
- Defined in:
- app/policies/glib/application_policy.rb
Defined Under Namespace
Classes: Scope
Class Attribute Summary collapse
-
.catch_all ⇒ Object
readonly
Returns the value of attribute catch_all.
Instance Attribute Summary collapse
-
#controller ⇒ Object
readonly
Returns the value of attribute controller.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#policy_name ⇒ Object
readonly
Returns the value of attribute policy_name.
-
#record ⇒ Object
readonly
Returns the value of attribute record.
-
#request ⇒ Object
readonly
Returns the value of attribute request.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Class Method Summary collapse
Instance Method Summary collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
125 126 127 128 129 130 131 |
# File 'app/policies/glib/application_policy.rb', line 125 def method_missing(name, *args, &block) if name.to_s.end_with?('?') && catch_all call_catch_all else super end end |
Class Attribute Details
.catch_all ⇒ Object (readonly)
Returns the value of attribute catch_all.
36 37 38 |
# File 'app/policies/glib/application_policy.rb', line 36 def catch_all @catch_all end |
Instance Attribute Details
#controller ⇒ Object (readonly)
Returns the value of attribute controller.
5 6 7 |
# File 'app/policies/glib/application_policy.rb', line 5 def controller @controller end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
5 6 7 |
# File 'app/policies/glib/application_policy.rb', line 5 def params @params end |
#policy_name ⇒ Object (readonly)
Returns the value of attribute policy_name.
5 6 7 |
# File 'app/policies/glib/application_policy.rb', line 5 def policy_name @policy_name end |
#record ⇒ Object (readonly)
Returns the value of attribute record.
5 6 7 |
# File 'app/policies/glib/application_policy.rb', line 5 def record @record end |
#request ⇒ Object (readonly)
Returns the value of attribute request.
5 6 7 |
# File 'app/policies/glib/application_policy.rb', line 5 def request @request end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
5 6 7 |
# File 'app/policies/glib/application_policy.rb', line 5 def user @user end |
Class Method Details
.args_builder ⇒ Object
142 143 144 |
# File 'app/policies/glib/application_policy.rb', line 142 def self.args_builder Proc.new { |controller| [] } end |
.inherited(base) ⇒ Object
38 39 40 41 |
# File 'app/policies/glib/application_policy.rb', line 38 def inherited(base) base.should_exist_attributes = should_exist_attributes.dup super end |
Instance Method Details
#helpers ⇒ Object
147 148 149 |
# File 'app/policies/glib/application_policy.rb', line 147 def helpers controller.helpers end |
#scope ⇒ Object
134 135 136 137 138 139 |
# File 'app/policies/glib/application_policy.rb', line 134 def scope policy_scope_class = Pundit::PolicyFinder.new(@policy_name).scope return unless policy_scope_class controller.policy_scope(record.class, policy_scope_class: policy_scope_class) end |