Class: PDC::Resource::Associations::HasMany
- Inherits:
-
Association
- Object
- Relation
- Association
- PDC::Resource::Associations::HasMany
- Defined in:
- lib/pdc/resource/associations/has_many.rb
Instance Attribute Summary
Attributes inherited from Association
Attributes inherited from Relation
Instance Method Summary collapse
-
#initialize(*args) ⇒ HasMany
constructor
A new instance of HasMany.
- #load ⇒ Object
Methods inherited from Relation
#all!, #count, #each, #find, #uri
Methods included from Pagination
Methods included from Finder
Methods included from Query
Methods included from Logging
Constructor Details
#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 |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class PDC::Resource::Relation
Instance Method Details
#load ⇒ Object
15 16 17 |
# File 'lib/pdc/resource/associations/has_many.rb', line 15 def load self end |