
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
-
-
Sam Smoot May 20th, 2008 @ 09:36 PM
Ah, this is what you were talking about Carl. :-)
k, I'll take care of it. Guessing we can just empty the collections on the proxies and reset load-state and that should about do it.
I'll spec it out tho'.
-
Sam Smoot May 21st, 2008 @ 01:05 AM
I've pushed some unspecced code that should resolve this. But like I said, unspecced. I'll figure out how to do that in the morning.
So... tentatively resolved. Hopefully. :-)
-
-
Carl May 21st, 2008 @ 10:26 AM
Sam, you're the best! We're still trying out a few things, but so far, so good. Seems to be working. Thanks again!
-
Sam Smoot June 2nd, 2008 @ 06:29 PM
- State changed from new to resolved
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.
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
- Nobody is watching this ticket.