Class: ActiveRecord::Reflection::PolymorphicReflection
- Inherits:
-
AssociationReflection
- Object
- AssociationReflection
- ActiveRecord::Reflection::PolymorphicReflection
- Defined in:
- lib/has_many_polymorphs/reflection.rb
Overview
The reflection built by the has_many_polymorphs method.
Inherits from ActiveRecord::Reflection::AssociationReflection.
Instance Method Summary collapse
-
#check_validity! ⇒ Object
Stub out the validity check.
-
#class_name ⇒ Object
Set the classname of the target.
-
#source_reflection ⇒ Object
Return the source reflection.
Instance Method Details
#check_validity! ⇒ Object
Stub out the validity check. Has_many_polymorphs checks validity on macro creation, not on reflection.
37 38 39 |
# File 'lib/has_many_polymorphs/reflection.rb', line 37 def check_validity! # nothing end |
#class_name ⇒ Object
Set the classname of the target. Uses the join class name.
49 50 51 52 |
# File 'lib/has_many_polymorphs/reflection.rb', line 49 def class_name # normally is the classname of the association target @class_name ||= [:join_class_name] end |
#source_reflection ⇒ Object
Return the source reflection.
42 43 44 45 46 |
# File 'lib/has_many_polymorphs/reflection.rb', line 42 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 |