aboutsummaryrefslogtreecommitdiffstats
path: root/activeresource/lib
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2008-03-28 19:58:46 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2008-03-28 19:58:46 +0000
commit9300ebd86fa39c6ea96cf39ef50ba5337dca6157 (patch)
treea43c663d35a05e87049de541e90a904f6da97f90 /activeresource/lib
parent388e5d3fac146ee10b636aca195620c562cdb522 (diff)
downloadrails-9300ebd86fa39c6ea96cf39ef50ba5337dca6157.tar.gz
rails-9300ebd86fa39c6ea96cf39ef50ba5337dca6157.tar.bz2
rails-9300ebd86fa39c6ea96cf39ef50ba5337dca6157.zip
Fixed that to_param should be used and honored instead of hardcoding the id (closes #11406) [gspiers]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9114 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activeresource/lib')
-rw-r--r--activeresource/lib/active_resource/base.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/activeresource/lib/active_resource/base.rb b/activeresource/lib/active_resource/base.rb
index 4d43a800eb..37e77d4f93 100644
--- a/activeresource/lib/active_resource/base.rb
+++ b/activeresource/lib/active_resource/base.rb
@@ -350,7 +350,7 @@ module ActiveResource
#
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)}"
+ "#{prefix(prefix_options)}#{collection_name}/#{id}.#{format.extension}#{query_string(query_options)}"
end
# Gets the collection path for the REST resources. If the +query_options+ parameter is omitted, Rails
@@ -760,7 +760,7 @@ module ActiveResource
# that_guy.exists?
# # => false
def exists?
- !new? && self.class.exists?(id, :params => prefix_options)
+ !new? && self.class.exists?(to_param, :params => prefix_options)
end
# A method to convert the the resource to an XML string.
@@ -807,7 +807,7 @@ module ActiveResource
# my_branch.name
# # => Wilson Road
def reload
- self.load(self.class.find(id, :params => @prefix_options).attributes)
+ self.load(self.class.find(to_param, :params => @prefix_options).attributes)
end
# A method to manually load attributes from a hash. Recursively loads collections of
@@ -903,7 +903,7 @@ module ActiveResource
end
def element_path(options = nil)
- self.class.element_path(id, options || prefix_options)
+ self.class.element_path(to_param, options || prefix_options)
end
def collection_path(options = nil)