Class: Sumaki::Model::Associations::Reflection::Repeated

Inherits:
Base
  • Object
show all
Defined in:
lib/sumaki/model/associations/reflection.rb

Overview

:nodoc:

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#association_for, #initialize, #model_class, #name

Constructor Details

This class inherits a constructor from Sumaki::Model::Associations::Reflection::Base

Class Method Details

.association_classObject



47
# File 'lib/sumaki/model/associations/reflection.rb', line 47

def self.association_class = Association::Repeated

Instance Method Details

#collection_classObject



49
50
51
52
53
54
55
56
57
58
59
# File 'lib/sumaki/model/associations/reflection.rb', line 49

def collection_class
  @collection_class ||= begin
    class_name = "#{model_class.name[/(\w+)$/]}Collection"

    if @owner_class.const_defined?(class_name)
      @owner_class.const_get(class_name)
    else
      @owner_class.const_set(class_name, Collection.build_subclass(self))
    end
  end
end