Module: ActiveResource::Reflection::ClassMethods
- Defined in:
- lib/active_resource/reflection.rb
Instance Method Summary collapse
Instance Method Details
#create_reflection(macro, name, options) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/active_resource/reflection.rb', line 22 def create_reflection(macro, name, ) reflection = AssociationReflection.new(macro, name, ) # Simple reflection based abstraction if (target = "#{reflection.class_name}Associations".safe_constantize) method_name = "when_#{macro}".to_sym target.send(method_name, self, ) if target.respond_to? method_name end self.reflections = self.reflections.merge(name => reflection) reflection end |