Created
February 26, 2013 07:00
-
-
Save budnik/5036536 to your computer and use it in GitHub Desktop.
rails WTF?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class FooBarController < ApplicationController | |
## | |
##This unscoping works: | |
def index | |
Campaign.unscoped do | |
Advertiser.unscoped do | |
@invoices = Invoice.all :include => [:campaign, :advertiser] | |
end | |
end | |
respond_to do |format| | |
format.html # index.html.erb | |
format.json { render json: @invoices } | |
end | |
end | |
## | |
## But this doesn't: | |
def index | |
Campaign.unscoped do | |
Advertiser.unscoped do | |
@invoices = Invoice.all :include => {:campaign => :advertiser} | |
end | |
end | |
respond_to do |format| | |
format.html # index.html.erb | |
format.json { render json: @invoices } | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment