Module: ActiveAny::Associations::ClassMethods

Defined in:
lib/active_any/associations.rb

Instance Method Summary collapse

Instance Method Details

#belongs_to(name, scope = nil, options = {}) ⇒ Object



38
39
40
41
# File 'lib/active_any/associations.rb', line 38

def belongs_to(name, scope = nil, options = {})
  reflection = Builder::BelongsTo.build(self, name, scope, options)
  Reflection.add_reflection self, name, reflection
end

#has_many(name, scope = nil, options = {}) ⇒ Object



33
34
35
36
# File 'lib/active_any/associations.rb', line 33

def has_many(name, scope = nil, options = {})
  reflection = Builder::HasMany.build(self, name, scope, options)
  Reflection.add_reflection self, name, reflection
end

#has_one(name, scope = nil, options = {}) ⇒ Object



43
44
45
46
# File 'lib/active_any/associations.rb', line 43

def has_one(name, scope = nil, options = {})
  reflection = Builder::HasOne.build(self, name, scope, options)
  Reflection.add_reflection self, name, reflection
end