Class: HasManyOptions
- Inherits:
-
AssocOptions
- Object
- AssocOptions
- HasManyOptions
- Defined in:
- lib/activeleopard/assoc_options.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.
- #other_join_column ⇒ Object
- #own_join_column ⇒ Object
Methods inherited from AssocOptions
Constructor Details
#initialize(name, self_class_name, options = {}) ⇒ HasManyOptions
Returns a new instance of HasManyOptions.
42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/activeleopard/assoc_options.rb', line 42 def initialize(name, self_class_name, = {}) name = name.to_s.singularize self_class_name = self_class_name.to_s.singularize defaults = { foreign_key: ("#{self_class_name.underscore}_id").to_sym, class_name: name.camelcase, primary_key: :id } defaults.merge().each do |option, opt_name| send("#{option}=", opt_name) end end |