Class: Spree::Policy
- Inherits:
-
Object
- Object
- Spree::Policy
- Extended by:
- FriendlyId
- Includes:
- TranslatableResource
- Defined in:
- app/models/spree/policy.rb
Constant Summary collapse
- UNIQUENESS_SCOPE =
i[owner_id owner_type].freeze
- TRANSLATABLE_FIELDS =
Translations
i[name body].freeze
Class Method Summary collapse
-
.for_store(store) ⇒ Object
For policies, store.policies returns all policies owned by the store We don’t want to filter out other policies in requests that use
for_storewhen they have a different owner type.
Instance Method Summary collapse
Class Method Details
.for_store(store) ⇒ Object
For policies, store.policies returns all policies owned by the store We don’t want to filter out other policies in requests that use for_store when they have a different owner type
60 61 62 |
# File 'app/models/spree/policy.rb', line 60 def self.for_store(store) store.policies.or(where.not(owner_type: 'Spree::Store')) end |
Instance Method Details
#really_destroy_slugs! ⇒ Object
68 69 70 |
# File 'app/models/spree/policy.rb', line 68 def really_destroy_slugs! slugs.with_deleted.each(&:really_destroy!) end |
#with_body? ⇒ Boolean
64 65 66 |
# File 'app/models/spree/policy.rb', line 64 def with_body? body.present? end |