Class: ApplicationSetting::TermPolicy
- Inherits:
-
BasePolicy
- Object
- DeclarativePolicy::Base
- BasePolicy
- ApplicationSetting::TermPolicy
- Includes:
- Gitlab::Utils::StrongMemoize
- Defined in:
- app/policies/application_setting/term_policy.rb
Instance Attribute Summary
Attributes inherited from DeclarativePolicy::Base
Instance Method Summary collapse
-
#agreement ⇒ Object
rubocop: disable CodeReuse/ActiveRecord.
Methods included from Gitlab::Utils::StrongMemoize
#clear_memoization, #strong_memoize, #strong_memoized?
Methods inherited from DeclarativePolicy::Base
ability_map, #allowed?, #banned?, #cache, #cached?, #can?, #condition, condition, conditions, configuration_for, #debug, delegate, #delegated_policies, delegations, desc, #disallowed?, enable_when, global_actions, #initialize, #inspect, last_options, last_options!, overrides, own_ability_map, own_conditions, own_delegations, own_global_actions, #policy_for, prevent_all_when, prevent_when, #repr, rule, #runner, with_options, with_scope, with_score
Constructor Details
This class inherits a constructor from DeclarativePolicy::Base
Instance Method Details
#agreement ⇒ Object
rubocop: disable CodeReuse/ActiveRecord
23 24 25 26 27 28 29 |
# File 'app/policies/application_setting/term_policy.rb', line 23 def agreement strong_memoize(:agreement) do next nil if @user.nil? || @subject.nil? @user.term_agreements.find_by(term: @subject) end end |