Class: SimplyCouch::Model::HasMany::Property
- Inherits:
-
AssociationProperty
- Object
- AssociationProperty
- SimplyCouch::Model::HasMany::Property
- Defined in:
- lib/simply_couch/model/has_many.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.
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 |
# File 'lib/simply_couch/model/has_many.rb', line 145 def initialize(owner_clazz, name, = {}) = { :dependent => :nullify, :through => nil, :class_name => owner_clazz.find_association_class_name(name), :foreign_key => nil }.update() @name, @options = name, .assert_valid_keys(:dependent, :through, :class_name, :foreign_key) if [:through] owner_clazz.class_eval do _define_cache_accessors(name, ) define_has_many_through_getter(name, , [:through]) define_has_many_count(name, , [:through]) end else owner_clazz.class_eval do _define_cache_accessors(name, ) define_has_many_getter(name, ) define_has_many_setter_add(name, ) define_has_many_setter_remove(name, ) define_has_many_setter_remove_all(name, ) define_has_many_count(name, ) end end end |