class ActiveRecord::Reflection::PolymorphicReflection

The reflection built by the has_many_polymorphs method.

Inherits from ActiveRecord::Reflection::AssociationReflection.

Public Instance Methods

check_validity!() click to toggle source

Stub out the validity check. Has_many_polymorphs checks validity on macro creation, not on reflection.

# File lib/has_many_polymorphs/reflection.rb, line 38
def check_validity!
  # nothing
end
class_name() click to toggle source

Set the classname of the target. Uses the join class name.

# File lib/has_many_polymorphs/reflection.rb, line 50
def class_name
  # normally is the classname of the association target
  @class_name ||= options[:join_class_name]
end
source_reflection() click to toggle source

Return the source reflection.

# File lib/has_many_polymorphs/reflection.rb, line 43
def source_reflection
  # normally is the has_many to the through model, but we return ourselves,
  # since there isn't a real source class for a polymorphic target
  self
end