Class: HasManyOptions

Inherits:
AssocOptions show all
Defined in:
lib/opal_orm/associatable.rb

Instance Attribute Summary

Attributes inherited from AssocOptions

#class_name, #foreign_key, #primary_key

Instance Method Summary collapse

Methods inherited from AssocOptions

#model_class, #table_name

Constructor Details

#initialize(name, self_class_name, options = {}) ⇒ HasManyOptions

Returns a new instance of HasManyOptions.



29
30
31
32
33
# File 'lib/opal_orm/associatable.rb', line 29

def initialize(name, self_class_name, options = {})
  @foreign_key = options[:foreign_key] || "#{self_class_name.downcase}_id".to_sym
  @class_name = options[:class_name] || name.to_s.camelcase.singularize
  @primary_key = options[:primary_key] || :id
end