Module: ActiveRecord::Associations::ClassMethods
- Defined in:
- lib/serialized_attributes/has_references_to.rb
Instance Method Summary collapse
- #create_has_references_to_reflection(association_id, options, &extension) ⇒ Object
- #has_references_to(association_id, options = {}, &extension) ⇒ Object
Instance Method Details
#create_has_references_to_reflection(association_id, options, &extension) ⇒ Object
52 53 54 55 56 57 58 |
# File 'lib/serialized_attributes/has_references_to.rb', line 52 def create_has_references_to_reflection(association_id, , &extension) #options.assert_valid_keys(valid_keys_for_has_many_association) [:extend] = create_extension_modules(association_id, extension, [:extend]) reflection = ActiveRecord::Reflection::AssociationReflection.new(:has_many, association_id, , self) write_inheritable_hash :reflections, name => reflection reflection end |
#has_references_to(association_id, options = {}, &extension) ⇒ Object
60 61 62 63 64 65 66 |
# File 'lib/serialized_attributes/has_references_to.rb', line 60 def has_references_to(association_id, = {}, &extension) reflection = create_has_references_to_reflection(association_id, , &extension) configure_dependency_for_has_many(reflection) add_association_callbacks(reflection.name, reflection.) collection_accessor_methods(reflection, HasReferencesToAssociation) end |