Sha256: 386697fe90d41c2c0fbda1f534bcb0fec36b8ede5d65f4dd09e8edf1baed00a4
Contents?: true
Size: 411 Bytes
Versions: 55
Compression:
Stored size: 411 Bytes
Contents
module WithUsages extend ActiveSupport::Concern included do has_many :usages, as: :item end def usage_in_organization(organization = Organization.current) usages.in_organization(organization).first.try(:parent_item) end def usage_in_organization_of_type(type, organization = Organization.current) item = usage_in_organization(organization) item.is_a?(type) ? item : nil end end
Version data entries
55 entries across 55 versions & 2 rubygems