Loading video...

Video Failed to Load

Go Home

Why should you avoid calling `where` in ActiveRecord model instance methods?

25,498 views • 1 year ago •via X (Twitter)

10 Comments

Nate Berkopec's profile picture
Nate Berkopec1 year ago

i'll learn how to screencast properly one day, today you're just gonna have to squint

austn.net's profile picture
austn.net1 year ago

Oooooh I have a staff engineer who's gonna hate that I know this now

Nolan's profile picture
Nolan1 year ago

I have found today’s activity

John Athayde's profile picture
John Athayde1 year ago

Awesome. I had not seen that Justin Weiss article, but I’m going to give that a whirl on some persistent N+1 issues I have.

Jeremy Kreutzbender's profile picture
Jeremy Kreutzbender1 year ago

The comment I wrote a few days ago speaks for itself. The jira_project method does a funky find_by using data from a json column

daniel T.'s profile picture
daniel T.1 year ago

can you share the article that you mentioned on the video ? 🙏

Mikkel Malmberg's profile picture
Mikkel Malmberg1 year ago

Totally agree. The `where` is a good way to remember to look out for something like this. For the problem at hand, this is probably something you ought to do once at write time and in that case the N+1 wouldn't be (as big) a problem.

Justin Marsh's profile picture
Justin Marsh1 year ago

Great job. 💪🏼 I would love watch to have more of these!

gato magro's profile picture
gato magro1 year ago

Interesting that I'd never seen AR methods used in such way in model instances(instead it was something resembling query builder or scope), but quite lot of times inside facades/presenters

CuriousWBT's profile picture
CuriousWBT1 year ago

I really appreciate your straightforward delivery.

Related Videos