Skip to content

Commit

Permalink
Fix reload error when path prefix is used. Closes #8727.
Browse files Browse the repository at this point in the history
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7082 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information
jeremy committed Jun 22, 2007
1 parent dae6108 commit e682fee
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
2 changes: 2 additions & 0 deletions 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]
Expand Down
2 changes: 1 addition & 1 deletion activeresource/lib/active_resource/base.rb
Expand Up @@ -294,7 +294,7 @@ def to_xml(options={})

# 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
Expand Down
11 changes: 11 additions & 0 deletions activeresource/test/base_test.rb
Expand Up @@ -293,6 +293,17 @@ def test_load_preserves_prefix_options
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')
Expand Down

0 comments on commit e682fee

Please sign in to comment.