#287 ✓resolved
Camilo Lopez

Resource.reload does not reload associations

Reported by Camilo Lopez | May 15th, 2008 @ 12:59 PM

When a resource calls reload it's association proxies are not, like in:

# @foo instance of resource Foo

irb(test_new_articles(Test)):002:0> @foo.articles.size
=> 1

irb(test_new_articles(Test)):003:0> a = Foo.first :id => @foo.id
=> #<Foo ... >

irb(test_new_articles(Test)):004:0> a == @foo
=> true

irb(test_new_articles(Test)):005:0> a.articles << Article.new
=> [#<Article ... > , #<Article ... >]

irb(test_new_articles(Test)):006:0> a.save
=> false

irb(test_new_articles(Test)):007:0> @foo.reload
=> [#<Foo ... >]

irb(test_new_articles(Test)):008:0> @foo.articles.size == a.articles.size
=> false

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

People watching this ticket