module ActiveRecord::Associations::ClassMethods

Public Instance Methods

create_has_references_to_reflection(association_id, options, &extension) click to toggle source
# File lib/has_references_to.rb, line 52
def create_has_references_to_reflection(association_id, options, &extension)
  #options.assert_valid_keys(valid_keys_for_has_many_association)
  options[:extend] = create_extension_modules(association_id, extension, options[:extend])
  reflection = ActiveRecord::Reflection::AssociationReflection.new(:has_many, association_id, options, self)
  write_inheritable_hash :reflections, name => reflection
  reflection
end
has_references_to(association_id, options = {}, &extension) click to toggle source
# File lib/has_references_to.rb, line 60
def has_references_to(association_id, options = {}, &extension)
  reflection = create_has_references_to_reflection(association_id, options, &extension)
  configure_dependency_for_has_many(reflection)
  add_association_callbacks(reflection.name, reflection.options)

  collection_accessor_methods(reflection, HasReferencesToAssociation)
end