Module: ActiveRecord::Collections::Collectable::Model

Defined in:
lib/active_record/collections/collectable.rb

Instance Method Summary collapse

Instance Method Details

#collection(*criteria) ⇒ Object Also known as: collect



14
15
16
# File 'lib/active_record/collections/collectable.rb', line 14

def collection(*criteria)
  kollektion.new(self, *criteria)
end

#collection_class(klass = nil) ⇒ Object



5
6
7
8
# File 'lib/active_record/collections/collectable.rb', line 5

def collection_class(klass=nil)
  @collection_class = klass unless klass.nil?
  @collection_class
end

#kollektionObject



10
11
12
# File 'lib/active_record/collections/collectable.rb', line 10

def kollektion
  @collection_class || ActiveRecord::Collection.collections.to_a.select { |c| c.collectable == self }.first || ActiveRecord::Collection
end