Class: HasManyOptions
- Inherits:
-
AssocOptions
- Object
- AssocOptions
- HasManyOptions
- Defined in:
- lib/sql_object/associatable.rb
Overview
Used to build has_many associations.
Instance Attribute Summary
Attributes inherited from AssocOptions
#class_name, #foreign_key, #primary_key
Instance Method Summary collapse
-
#initialize(name, self_class_name, options = {}) ⇒ HasManyOptions
constructor
A new instance of HasManyOptions.
Methods inherited from AssocOptions
Constructor Details
#initialize(name, self_class_name, options = {}) ⇒ HasManyOptions
Returns a new instance of HasManyOptions.
39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/sql_object/associatable.rb', line 39 def initialize(name, self_class_name, = {}) defaults = { primary_key: :id, foreign_key: "#{self_class_name.to_s.underscore}_id".to_sym, class_name: name.to_s.singularize.camelcase } = defaults.merge() @primary_key = [:primary_key] @foreign_key = [:foreign_key] @class_name = [:class_name] end |