rabl N+1 issues

41 Views Asked by At

I've got the following call in Rails 4

@obj = A.includes(B: { C: D}).find_by_uuid(params[:id])

Which works fine when viewing the SQL. The problem is the following RABL template creates multiple D database queries again. I'm using 0.14.0. This is the structure of my simplified Rabl.

show.rabl

object @obj
extends "documents/base"

base.rabl

child :B => :asb do |ab|
    object ab
    extends "shared/asb"
end

asb.rabl

child(:C => :csb) do
    attributes :id 
    child(:D => :dsb) do
         attributes :x, :y <<----------- multiple database calls
    end
  end
0

There are 0 best solutions below