Module: LinkedRails::Policy
- Extended by:
- ActiveSupport::Concern
- Included in:
- ApplicationPolicy
- Defined in:
- lib/linked_rails/policy.rb,
lib/linked_rails/policy/attribute_conditions.rb
Defined Under Namespace
Modules: AttributeConditions, ClassMethods
Instance Method Summary
collapse
Instance Method Details
#create? ⇒ Boolean
53
54
55
|
# File 'lib/linked_rails/policy.rb', line 53
def create?
false
end
|
#create_child?(klass, **opts) ⇒ Boolean
26
27
28
|
# File 'lib/linked_rails/policy.rb', line 26
def create_child?(klass, **opts)
child_policy(klass, opts).create?
end
|
#destroy? ⇒ Boolean
57
58
59
|
# File 'lib/linked_rails/policy.rb', line 57
def destroy?
false
end
|
#index_children?(klass, **opts) ⇒ Boolean
30
31
32
|
# File 'lib/linked_rails/policy.rb', line 30
def index_children?(klass, **opts)
child_policy(klass, opts).show?
end
|
#permitted_attributes ⇒ Object
34
35
36
37
38
39
|
# File 'lib/linked_rails/policy.rb', line 34
def permitted_attributes
self.class.permitted_attributes
.select { |opts| attribute_permitted?(opts[:conditions]) }
.map { |opts| sanitized_attributes(opts[:attributes], opts[:options] || {}) }
.flatten
end
|
#policy_class ⇒ Object
41
42
43
|
# File 'lib/linked_rails/policy.rb', line 41
def policy_class
self.class.policy_class
end
|
#show? ⇒ Boolean
45
46
47
|
# File 'lib/linked_rails/policy.rb', line 45
def show?
false
end
|
#update? ⇒ Boolean
49
50
51
|
# File 'lib/linked_rails/policy.rb', line 49
def update?
false
end
|