1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Fix reload error when path prefix is used. Closes #8727.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7082 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
Jeremy Kemper 2007-06-22 18:15:40 +00:00
parent dae6108998
commit e682fee121
3 changed files with 14 additions and 1 deletions

View file

@ -1,5 +1,7 @@
*SVN* *SVN*
* Fix reload error when path prefix is used. #8727 [Ian Warshak]
* Remove ActiveResource::Struct because it hasn't proven very useful. Creating a new ActiveResource::Base subclass is often less code and always clearer. #8612 [Josh Peek] * Remove ActiveResource::Struct because it hasn't proven very useful. Creating a new ActiveResource::Base subclass is often less code and always clearer. #8612 [Josh Peek]
* Fix query methods on resources. [Cody Fauser] * Fix query methods on resources. [Cody Fauser]

View file

@ -294,7 +294,7 @@ module ActiveResource
# Reloads the attributes of this object from the remote web service. # Reloads the attributes of this object from the remote web service.
def reload def reload
self.load(self.class.find(id, @prefix_options).attributes) self.load(self.class.find(id, :params => @prefix_options).attributes)
end end
# Manually load attributes from a hash. Recursively loads collections of # Manually load attributes from a hash. Recursively loads collections of

View file

@ -293,6 +293,17 @@ class BaseTest < Test::Unit::TestCase
ryan = Person.new(:id => 1, :name => 'Ryan', :address => address) ryan = Person.new(:id => 1, :name => 'Ryan', :address => address)
assert_equal address.prefix_options, ryan.address.prefix_options assert_equal address.prefix_options, ryan.address.prefix_options
end end
def test_reload_works_with_prefix_options
address = StreetAddress.find(1, :params => { :person_id => 1 })
assert_equal address, address.reload
end
def test_reload_works_without_prefix_options
person = Person.find(:first)
assert_equal person, person.reload
end
def test_create def test_create
rick = Person.create(:name => 'Rick') rick = Person.create(:name => 'Rick')