method
element_path
v3.2.1 -
Show latest stable
- Class:
ActiveResource::Base
element_path(id, prefix_options = {}, query_options = nil)public
Gets the element path for the given ID in id. If the query_options parameter is omitted, Rails will split from the prefix options.
Options
prefix_options - A hash to add a prefix to the request for nested URLs (e.g., :account_id => 19
would yield a URL like <tt>/accounts/19/purchases.json</tt>).
query_options - A hash to add items to the query string for the request.
Examples
Post.element_path(1) # => /posts/1.json class Comment < ActiveResource::Base self.site = "http://37s.sunrise.i/posts/:post_id/" end Comment.element_path(1, :post_id => 5) # => /posts/5/comments/1.json Comment.element_path(1, :post_id => 5, :active => 1) # => /posts/5/comments/1.json?active=1 Comment.element_path(1, {:post_id => 5}, {:active => 1}) # => /posts/5/comments/1.json?active=1