lib/her/model/associations/association.rb
# Fetches the data specified by id
#
# @example
#   class User
#     include Her::Model
#     has_many :comments
#   end
#
#   user = User.find(1)
#   user.comments.find(3) # Fetched via GET "/users/1/comments/3
Fetches the data specified by id
Fetches the data specified by id
def find(id)
          return nil if id.blank?
          path = build_association_path -> { "#{@parent.request_path(@params)}#{@opts[:path]}/#{id}" }
          @klass.get_resource(path, @params)
        end
def find ( id ) return nil if id . blank? path = build_association_path -> { "#{@parent.request_path(@params)}#{@opts[:path]}/#{id}" } @klass . get_resource ( path , @params ) end
Fetches the data specified by id
Fetches the data specified by id
id
<not_specific>
example
class User include Her::Model has_many :comments end user = User.find(1) user.comments.find(3) # Fetched via GET "/users/1/comments/3
class User include Her :: Model has_many : comments end user = User . find ( 1 ) user . comments . find ( 3 ) # Fetched via GET " / users / 1 / comments / 3