Class: DynamicActiveResource::Associations::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/dynamic_active_resource/associations/base.rb

Direct Known Subclasses

BelongsTo, HasMany

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(method_name, options = {}) ⇒ Base

Returns a new instance of Base.



5
6
7
8
9
# File 'lib/dynamic_active_resource/associations/base.rb', line 5

def initialize(method_name, options = {})
  @method_name = method_name.to_s
  class_name = options[:through] || @method_name.singularize.camelize
  @associated_class_name = class_name
end

Instance Attribute Details

#method_nameObject (readonly)

Returns the value of attribute method_name.



4
5
6
# File 'lib/dynamic_active_resource/associations/base.rb', line 4

def method_name
  @method_name
end

Instance Method Details

#resources_for(caller) ⇒ Object

fetches the resources for the association. requires the caller to be passed through self.



13
14
15
# File 'lib/dynamic_active_resource/associations/base.rb', line 13

def resources_for(caller)
  raise 'Not Implemented'
end