Class: BelongsToOptions

Inherits:
AssocOptions show all
Defined in:
lib/bezelrecord_base/associatable.rb

Instance Attribute Summary

Attributes inherited from AssocOptions

#class_name, #foreign_key, #primary_key

Instance Method Summary collapse

Methods inherited from AssocOptions

#model_class, #table_name

Constructor Details

#initialize(name, options = {}) ⇒ BelongsToOptions

Returns a new instance of BelongsToOptions.



21
22
23
24
25
# File 'lib/bezelrecord_base/associatable.rb', line 21

def initialize(name, options = {})
  @foreign_key = options[:foreign_key] || (name.to_s + "Id").underscore.to_sym
  @primary_key = options[:primary_key] || :id
  @class_name = options[:class_name] || name.to_s.camelcase
end