ActiveResource::Reflection::ClassMethods

Public Instance Methods

create_reflection(macro, name, options) click to toggle source
# File lib/active_resource/reflection.rb, line 22
def create_reflection(macro, name, options)
  reflection = AssociationReflection.new(macro, name, options)

  # Simple reflection based abstraction
  if (target = "#{reflection.class_name}Associations".safe_constantize)
    method_name = "when_#{macro}".to_sym
    target.send(method_name, self, options) if target.respond_to? method_name
  end

  self.reflections = self.reflections.merge(name => reflection)
  reflection
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.