Module: WithUsages
- Extended by:
- ActiveSupport::Concern
- Included in:
- Content
- Defined in:
- app/models/concerns/with_usages.rb
Instance Method Summary collapse
- #usage_in_organization(organization = Organization.current) ⇒ Object
- #usage_in_organization_of_type(type, organization = Organization.current) ⇒ Object
Instance Method Details
#usage_in_organization(organization = Organization.current) ⇒ Object
10 11 12 |
# File 'app/models/concerns/with_usages.rb', line 10 def usage_in_organization(organization = Organization.current) usages_in_organization(organization).first.try(:parent_item) end |
#usage_in_organization_of_type(type, organization = Organization.current) ⇒ Object
14 15 16 17 |
# File 'app/models/concerns/with_usages.rb', line 14 def usage_in_organization_of_type(type, organization = Organization.current) item = usage_in_organization(organization) item.is_a?(type) ? item : nil end |