diff options
-rw-r--r-- | activeresource/CHANGELOG | 2 | ||||
-rw-r--r-- | activeresource/lib/active_resource/base.rb | 2 | ||||
-rw-r--r-- | activeresource/test/base_test.rb | 11 |
3 files changed, 14 insertions, 1 deletions
diff --git a/activeresource/CHANGELOG b/activeresource/CHANGELOG index 8dbfd41322..cde84be05b 100644 --- a/activeresource/CHANGELOG +++ b/activeresource/CHANGELOG @@ -1,5 +1,7 @@ *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] * Fix query methods on resources. [Cody Fauser] diff --git a/activeresource/lib/active_resource/base.rb b/activeresource/lib/active_resource/base.rb index 78d1c0033a..b4a9888ee5 100644 --- a/activeresource/lib/active_resource/base.rb +++ b/activeresource/lib/active_resource/base.rb @@ -294,7 +294,7 @@ module ActiveResource # Reloads the attributes of this object from the remote web service. def reload - self.load(self.class.find(id, @prefix_options).attributes) + self.load(self.class.find(id, :params => @prefix_options).attributes) end # Manually load attributes from a hash. Recursively loads collections of diff --git a/activeresource/test/base_test.rb b/activeresource/test/base_test.rb index 328d3ae133..48b1045b61 100644 --- a/activeresource/test/base_test.rb +++ b/activeresource/test/base_test.rb @@ -293,6 +293,17 @@ class BaseTest < Test::Unit::TestCase ryan = Person.new(:id => 1, :name => 'Ryan', :address => address) assert_equal address.prefix_options, ryan.address.prefix_options 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 rick = Person.create(:name => 'Rick') |