module ActiveAny::Reflection

Public Class Methods

add_reflection(klass, name, reflection) click to toggle source
# File lib/active_any/reflection.rb, line 50
def self.add_reflection(klass, name, reflection)
  klass._reflections = klass.reflections.merge(name.to_s => reflection)
end
create(macro, name, scope, options, klass) click to toggle source
# File lib/active_any/reflection.rb, line 34
def self.create(macro, name, scope, options, klass)
  reflection_class =
    case macro
    when :has_one
      HasOneReflection
    when :belongs_to
      BelongsToReflection
    when :has_many
      HasManyReflection
    else
      raise "Unsupported Macro: #{macro}"
    end

  reflection_class.new(name, scope, options, klass)
end