module PowerEnum::Reflection
Used to patch ActiveRecord
reflections.
Public Instance Methods
Source
# File lib/power_enum/reflection.rb, line 26 def reflect_on_all_associations(macro = nil) reflect_on_all_enumerated + super(macro) end
Calls superclass method
Source
# File lib/power_enum/reflection.rb, line 12 def reflect_on_all_enumerated # Need to give it a full namespace to avoid getting Rails confused in development # mode where all objects are reloaded on every request. reflections.values.grep(PowerEnum::Reflection::EnumerationReflection) end
All {PowerEnum::Reflection::EnumerationReflection} reflections
Source
# File lib/power_enum/reflection.rb, line 30 def reflect_on_association(associated) reflect_on_enumerated(associated) || super(associated) end
Calls superclass method
Source
# File lib/power_enum/reflection.rb, line 21 def reflect_on_enumerated( enumerated ) key = enumerated.to_s reflections[key].is_a?(PowerEnum::Reflection::EnumerationReflection) ? reflections[key] : nil end
If the reflection of the given name is an EnumerationReflection
, returns the reflection, otherwise returns nil. @return [PowerEnum::Reflection::EnumerationReflection]