
Weird #reload behavior
Reported by Elliott Mason | March 13th, 2008 @ 01:52 PM
I'm trying to troubleshoot another bug and kept wondering why my tests passed but similar code in practice did not give proper results.
#Assume Topic has_many Posts and Post belongs_to Topic.
p = Post.new
p.topic = Topic.new
p.save
p.topic_id == p.topic.id #true
p.reload
p.topic_id == p.topic.id #true
#That's cool, but...
p = Post.all.last
p.topic #now returns nil
p.topic_id #now returns nil
Which leads me to conclude that #reload doesn't seem to be reloading properly in all cases. The spec written for the method works fine. For some reason in the context of associations it just behaves differently.
Comments and changes to this ticket
-
Dan Kubb (dkubb) April 15th, 2008 @ 03:09 AM
- no changes were found...
-
-
Sam Smoot April 28th, 2008 @ 06:20 PM
- Assigned user set to David Leal
- Milestone cleared.
-
Elliott Mason April 28th, 2008 @ 09:23 PM
I could try if I have the time. This bug was based on 0.3, it's probably irrelevant now.
-
Elliott Mason April 28th, 2008 @ 09:24 PM
I could try if I have the time. This bug was based on 0.3, it's probably irrelevant now.
-
Elliott Mason April 28th, 2008 @ 09:25 PM
I could try if I have the time. This bug was based on 0.3, it's probably irrelevant now.
-
Elliott Mason April 28th, 2008 @ 09:26 PM
I could try if I have the time. This bug was based on 0.3, it's probably irrelevant now.
-
Elliott Mason April 28th, 2008 @ 10:19 PM
Cool, my one reply became four replies. I even managed to go back in time to make the second one...
-
Sam Smoot May 2nd, 2008 @ 04:35 AM
- State changed from new to invalid
LH was having a bad day I think. Same thing happened to me. I'll go ahead and close this out for now then for now. Thanks.
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 »