module MR::FakeRecord::Associations::ClassMethods

Public Instance Methods

belongs_to(name, options = nil) click to toggle source
# File lib/mr/fake_record/associations.rb, line 23
def belongs_to(name, options = nil)
  self.reflections.add_belongs_to(self, name, options)
end
has_many(name, options = nil) click to toggle source
# File lib/mr/fake_record/associations.rb, line 31
def has_many(name, options = nil)
  self.reflections.add_has_many(self, name, options)
end
has_one(name, options = nil) click to toggle source
# File lib/mr/fake_record/associations.rb, line 27
def has_one(name, options = nil)
  self.reflections.add_has_one(self, name, options)
end
reflect_on_all_associations(type = nil) click to toggle source
# File lib/mr/fake_record/associations.rb, line 41
def reflect_on_all_associations(type = nil)
  self.reflections.all(type)
end
reflect_on_association(name) click to toggle source

ActiveRecord methods

# File lib/mr/fake_record/associations.rb, line 37
def reflect_on_association(name)
  self.reflections.find(name)
end
reflections() click to toggle source
# File lib/mr/fake_record/associations.rb, line 19
def reflections
  @reflections ||= MR::FakeRecord::ReflectionSet.new
end