Sha256: 1b3d20f725634e5632ecedd6024b0a322b83f3a8000005476b15f34951259225
Contents?: true
Size: 530 Bytes
Versions: 10
Compression:
Stored size: 530 Bytes
Contents
module FileContainer mattr_reader :types @@types ||= [] def self.included(base) return if @@types.include?(base) @@types << base base.instance_eval do include Associations end end def self.all @all ||= types.map{|t| t.where(1)} # lazy load :all of each type end module Associations def self.included(base) base.instance_eval do has_many :file_attachments, { :as => :attachable, :dependent => :destroy } end end end end
Version data entries
10 entries across 10 versions & 1 rubygems