Skip to content

Commit

Permalink
improved ActiveResource's .element_path and .new_element_path methods…
Browse files Browse the repository at this point in the history
… documentation by specifing how .site should be declared in order to use prefix_options
  • Loading branch information
dcrec1 authored and vijaydev committed Oct 14, 2011
1 parent 840246c commit dd27e2e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions activeresource/lib/active_resource/base.rb
Expand Up @@ -637,6 +637,10 @@ def prefix(options={}) "#{prefix_call}" end
# 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
#
Expand All @@ -663,6 +667,10 @@ def element_path(id, prefix_options = {}, query_options = nil)
# Post.new_element_path
# # => /posts/new.json
#
# class Comment < ActiveResource::Base
# self.site = "http://37s.sunrise.i/posts/:post_id/"
# end
#
# Comment.collection_path(:post_id => 5)
# # => /posts/5/comments/new.json
def new_element_path(prefix_options = {})
Expand Down

0 comments on commit dd27e2e

Please sign in to comment.