Forum: Ruby on Rails Broken caching in Rails 3.1.0

Ce4adf6bb453e85efc4e271195a9b204?d=identicon&s=25 Jones (Guest)
on 2011-10-09 17:39
(Received via mailing list)
I experience a strange issue in Rails 3.1.0 with activerecord

See the bottom lines of this gist. Why is there a difference in the
resultset of role.childs and role.childs.all

This happens in test and development mode.
89e9043b4c06df706c865bedc2559575?d=identicon&s=25 Kai K. (kai_k)
on 2011-10-09 22:01
(Received via mailing list)
Maybe this is an artifact of not using the proper plural of "child"? Try
"children" instead of "childs". Rails internally works a lot with
plurals and singulars. Something could go wrong here.

Other than that it's difficult to tell because you did not show your
definition. I'd also recommend using the built-in functions like
"" instead of defining methods like "add_subrole" -
may interfere with caching because "role.children" is evaluated lazily
Rails3 while "role.children.all" makes it evaluate now. Combined with
improper naming scheme this may be the culprit. It looks like you are
building children outside the knowledge of the relation.
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.