Class: SimplyStored::Couch::HasOne::Property
- Inherits:
-
AssociationProperty
- Object
- AssociationProperty
- SimplyStored::Couch::HasOne::Property
- Defined in:
- lib/simply_stored/couch/has_one.rb
Instance Attribute Summary
Attributes inherited from AssociationProperty
Instance Method Summary collapse
-
#initialize(owner_clazz, name, options = {}) ⇒ Property
constructor
A new instance of Property.
Methods inherited from AssociationProperty
#association?, #build, #dirty?, #serialize, #supports_dirty?
Constructor Details
#initialize(owner_clazz, name, options = {}) ⇒ Property
Returns a new instance of Property.
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/simply_stored/couch/has_one.rb', line 56 def initialize(owner_clazz, name, = {}) = { :dependent => :nullify, :class_name => name.to_s.singularize.camelize, :foreign_key => nil }.update() @name, @options = name, .assert_valid_keys(:dependent, :class_name, :foreign_key) owner_clazz.class_eval do define_has_one_getter(name, ) define_has_one_setter(name, ) end end |