Method: ActiveResource::Base.new_element_path
- Defined in:
- lib/active_resource/base.rb
.new_element_path(prefix_options = {}) ⇒ Object
Gets the new element path for REST resources.
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 /accounts/19/purchases/new.json).
Examples
Post.new_element_path
# => /posts/new.json
class Comment < ActiveResource::Base
self.site = "https://37s.sunrise.com/posts/:post_id"
end
Comment.collection_path(:post_id => 5)
# => /posts/5/comments/new.json
858 859 860 |
# File 'lib/active_resource/base.rb', line 858 def new_element_path( = {}) "#{prefix()}#{collection_name}/new#{format_extension}" end |