Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

first doesn't use loaded objects, it always queries #645

Open
smtlaissezfaire opened this issue Aug 18, 2016 · 1 comment
Open

first doesn't use loaded objects, it always queries #645

smtlaissezfaire opened this issue Aug 18, 2016 · 1 comment

Comments

@smtlaissezfaire
Copy link
Member

Notice this behavior on a has many proxy:

(byebug) self.messages.map(&:unread) [true] (byebug) self.messages.first.unread false

The first line uses the in-memory objects, while the second one reloads from the database.

@jamieorc
Copy link
Contributor

jamieorc commented Mar 7, 2017

I noticed this the other day. It's definitely a needed optimization. [0] will not load from the db.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants