static public Method

Base.element_path(id, prefix_options = {}, query_options = nil)

Contents:

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 URL’s (e.g., :account_id => 19 would yield a URL like /accounts/19/purchases.xml).
query_options:A hash to add items to the query string for the request.

Examples

Post.element_path(1)
# => /posts/1.xml

Comment.element_path(1, :post_id => 5)
# => /posts/5/comments/1.xml

Comment.element_path(1, :post_id => 5, :active => 1)
# => /posts/5/comments/1.xml?active=1

Comment.element_path(1, {:post_id => 5}, {:active => 1})
# => /posts/5/comments/1.xml?active=1

Source Code

# File active_resource/base.rb, line 287
def element_path(id, prefix_options = {}, query_options = nil)
  prefix_options, query_options = split_options(prefix_options) if query_options.nil?
  "#{prefix(prefix_options)}#{collection_name}/#{id}.#{format.extension}#{query_string(query_options)}"
end
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.