Class: HasManyOptions
- Inherits:
-
AssocOptions
- Object
- AssocOptions
- HasManyOptions
- Defined in:
- lib/railz_lite/models/associatable.rb
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.
35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/railz_lite/models/associatable.rb', line 35 def initialize(name, self_class_name, = {}) foreign_key_sym = "#{self_class_name.underscore}_id".to_sym class_name_val = name.to_s.camelcase.singularize send("primary_key=", :id) send("foreign_key=", foreign_key_sym) send("class_name=", class_name_val) .each do |attr, val| send("#{attr}=", val) end end |