Class: BelongsToOptions
- Inherits:
-
AssocOptions
- Object
- AssocOptions
- BelongsToOptions
- Defined in:
- lib/reloj/orm/associatable.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.
Methods inherited from AssocOptions
Constructor Details
#initialize(name, options = {}) ⇒ BelongsToOptions
Returns a new instance of BelongsToOptions.
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/reloj/orm/associatable.rb', line 21 def initialize(name, = {}) defaults = { foreign_key: "#{name.to_s.underscore}_id".to_sym, primary_key: :id, class_name: name.to_s.camelcase.singularize }.merge() defaults.each do |attribute, value| self.send("#{attribute}=", value) end end |