lib/her/model/paths.rb
# Defines a custom resource path for the resource
#
# @example
#  class User
#    include Her::Model
#    resource_path "/users/:id"
#  end
#
# Note that, if used in combination with resource_path, you may specify
# either the real primary key or the string ':id'. For example:
#
# @example
#  class User
#    include Her::Model
#    primary_key 'user_id'
#
#    # This works because we'll have a user_id attribute
#    resource_path '/users/:user_id'
#
#    # This works because we replace :id with :user_id
#    resource_path '/users/:id'
#  end
#
Defines a custom resource path for the resource
Defines a custom resource path for the resource
def resource_path(path = nil)
          if path.nil?
            @_her_resource_path ||= "#{root_element.to_s.pluralize}/:id"
          else
            @_her_resource_path = path
          end
        end
def resource_path ( path = nil ) if path . nil? @_her_resource_path ||= "#{root_element.to_s.pluralize}/:id" else @_her_resource_path = path end end
Defines a custom resource path for the resource
Defines a custom resource path for the resource
path
<not_specific>
example
class User include Her::Model resource_path "/users/:id" end Note that, if used in combination with resource_path, you may specify either the real primary key or the string ':id'. For example.
class User include Her :: Model resource_path " / users / : id " end Note that if used in combination with resource_path you may specify either the real primary key or the string ' : id ' . For example .
example
class User include Her::Model primary_key 'user_id' # This works because we'll have a user_id attribute resource_path '/users/:user_id' # This works because we replace :id with :user_id resource_path '/users/:id' end
class User include Her :: Model primary_key ' user_id ' # This works because we ' ll have a user_id attribute resource_path ' / users / : user_id ' # This works because we replace : id with : user_id resource_path ' / users / : id ' end