Module: Alchemy::RelatableResource
- Extended by:
- ActiveSupport::Concern
- Included in:
- Attachment, Picture
- Defined in:
- app/models/concerns/alchemy/relatable_resource.rb
Constant Summary collapse
- RELATED_INGREDIENTS_SUBQUERY =
SQL subquery selecting
related_object_idvalues for ingredients that reference a given polymorphic type. Intended to be composed into a NOT IN (…) clause bydeletableand any overrides in including classes. Takes one named bind :type - the polymorphic type name, typically the class name of the including model (e.g. “Alchemy::Attachment”). <<~SQL.squish SELECT related_object_id FROM alchemy_ingredients WHERE related_object_id IS NOT NULL AND related_object_type = :type SQL
Instance Method Summary collapse
-
#deletable? ⇒ Boolean
Returns true if object is not assigned to any ingredient.
Instance Method Details
#deletable? ⇒ Boolean
Returns true if object is not assigned to any ingredient.
48 49 50 |
# File 'app/models/concerns/alchemy/relatable_resource.rb', line 48 def deletable? .none? end |