Hello,
I am rather confused about what I''m seeing with an attribute of mine
that has been defined as a counter_cache.
''votes_count'' is the attribute that is a counter_cache var.
If I do this in my view...
<% p test.attributes %>
<% p test[:votes_count] %>
<% p test.votes_count %>
I get this printed out...
{"votes_count"=>11, "id"=>2}
11
1
Why does test.votes_count give me 1?
If I do a test.reload before calling those prints, then test.votes_count
gives me the correct value of 11.
Can somebody tell me why I''m seeing these results?
Thanks,
Andrew
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---