Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on Stack Overflow Makes Slow Pages 100x Faster By Simple SQL Tuning . Parent comment
users = User.where(:age => 10) # no rows fetched
# Once you access something on users, then the query happens users.each do |user| # something end
It's not really that "magic", it's useful.
ActiveRecord uses joins (mostly). If you are using a "non-standard" table schema, you can tell ActiveRecord what column to use on joins.
There are no comments on this comment yet.
users = User.where(:age => 10) # no rows fetched
# Once you access something on users, then the query happens users.each do |user| # something end
It's not really that "magic", it's useful.
ActiveRecord uses joins (mostly). If you are using a "non-standard" table schema, you can tell ActiveRecord what column to use on joins.