Module: Her::Model::Paths

Extended by:
ActiveSupport::Concern
Included in:
Her::Model
Defined in:
lib/castle-her/model/paths.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#request_path(params = {}) ⇒ Object

Return a path based on the collection path and a resource data

Examples:

class User
  include Her::Model
  collection_path "/utilisateurs"
end

User.find(1) # Fetched via GET /utilisateurs/1

Parameters:

  • params (Hash) (defaults to: {})

    An optional set of additional parameters for path construction. These will not override attributes of the resource.



17
18
19
# File 'lib/castle-her/model/paths.rb', line 17

def request_path(params = {})
  self.class.build_request_path(params.merge(attributes.dup))
end