We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Say I have the following models
class Region < ActiveRecord::Base has_many :departments end class Department < ActiveRecord::Base belongs_to :region end
In my controller I use includes because I need the department ids in my template.
includes
class RegionsController < ApplicationController def index @regions = Regions.includes(:departments).all end end
When I don't use extends in my template it works fine with only 2 queries.
extends
# app/views/regions/index.json.rabl collection @regions attributes :id, :name, :department_ids
But, when I use extends the eager loaded data are ignored and N+1 queries come around.
# app/views/regions/index.json.rabl collection @regions extends 'regions/show' # app/views/regions/show.json.rabl object @region attributes :id, :name, :department_ids
The text was updated successfully, but these errors were encountered:
I think this has been fixed. If not, please re-open
Sorry, something went wrong.
No branches or pull requests
Say I have the following models
In my controller I use
includes
because I need the department ids in my template.When I don't use
extends
in my template it works fine with only 2 queries.But, when I use
extends
the eager loaded data are ignored and N+1 queries come around.The text was updated successfully, but these errors were encountered: