Method: PDC::Resource::Associations::HasMany#initialize

Defined in:
lib/pdc/resource/associations/has_many.rb

#initialize(*args) ⇒ HasMany

Returns a new instance of HasMany.



6
7
8
9
10
11
12
13
# File 'lib/pdc/resource/associations/has_many.rb', line 6

def initialize(*args)
  super
  # This is the default uri. It can be overrided when defining a has_many association
  # if the uri is different with the default one.
  # E.g: has_many :releases, uri: 'rest_api/v1/releases/?product_version=:product_version_id'
  @options.reverse_merge!(uri: "#{parent_path}/:#{foreign_key}/#{@name}/(:#{primary_key})")
  @params[foreign_key] = parent.id
end