Class: HasManyOptions
- Inherits:
-
AssocOptions
- Object
- AssocOptions
- HasManyOptions
- Defined in:
- lib/laris/larisrecord/associatable.rb
Instance Attribute Summary
Attributes inherited from AssocOptions
#class_name, #foreign_key, #primary_key
Instance Method Summary collapse
-
#initialize(assoc_name, self_name, options = {}) ⇒ HasManyOptions
constructor
A new instance of HasManyOptions.
Methods inherited from AssocOptions
Constructor Details
#initialize(assoc_name, self_name, options = {}) ⇒ HasManyOptions
Returns a new instance of HasManyOptions.
28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/laris/larisrecord/associatable.rb', line 28 def initialize(assoc_name, self_name, = {}) defaults = { class_name: assoc_name.to_s.singularize.camelcase, foreign_key: "#{self_name.underscore}_id".to_sym, primary_key: :id } defaults.each do |attr, default| send("#{attr}=", ([attr] || default)) end end |