Class: BelongsToOptions
- Inherits:
-
AssocOptions
- Object
- AssocOptions
- BelongsToOptions
- 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, options = {}) ⇒ BelongsToOptions
constructor
A new instance of BelongsToOptions.
- #other_join_column ⇒ Object
- #own_join_column ⇒ Object
Methods inherited from AssocOptions
Constructor Details
#initialize(name, options = {}) ⇒ BelongsToOptions
Returns a new instance of BelongsToOptions.
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/activeleopard/assoc_options.rb', line 18 def initialize(name, = {}) name = name.to_s.singularize defaults = { foreign_key: ("#{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 |