Tag Archives: join

Chaining :include’s in Rails to reduce the number of SQL queries

Say you have the following data model and you want to execute a single query that returns all the data at once within the ActiveRecord tables, with the proper rails associations between them. Wouldn’t it be nice if you could do something like A.find(:all, :include => :b => :c => :d => :e) #v1 ? [...]
Posted in programming, rails, scalability | Also tagged , , , , , , | 1 Comment