Rails 3...
I have a controller..
class OrdersController < ApplicationController
def index
@os_orders = OrlandoOrder.all
@ct_orders = ChicagoOrder.all
end
end
And then I have the two models defined...
class ChicagoOrder < Order
Order::ActiveRecord::Base.table_name_prefix = 'ct_schema.'
end
class OrlandoOrder < Order
Order::ActiveRecord::Base.table_name_prefix = 'os_schema.'
end
And then the parent model...
class Order < ActiveRecord::Base
end
What I'm trying to do is have the same objects Orders in this case established across multiple database schemas...
According to the log, the sql is correct...
ChicagoOrder Load (60.7ms) SELECT ct_schema.orders.* FROM ct_schema.orders
However, instead of loading OrlandoOrder and then ChicagoOrder, it loads the first model specified TWICE. So in this case, its loading OrlandoOrder twice and running that sql statement twice and loading it into @ct_orders instead of ChicagoOrder.all.
Am I doing something natively wrong? Am I doing something rails isn't intended to do with the multiple schemas?
Please advise one way or the other, been staring at this for hours and can't seem to google the right terms to see if anyone else has shared my pain...
THANKS!!!!!!!!!