Hello,
I followed this tutorial
(http://wiki.rubyonrails.org/rails/pages/HowtoUseMultipleDatabases) on
configuring an application to use multiple databases. This works
beautifully, except when the server needs to fire up the FCGI process.
On the initial run when the server is booting up my app, it fails with a
typical Application Error. This is what is occurring behind the scenes:
-------------------------------------------------------
Processing StoreController#index (for 204.174.222.216 at 2006-09-11
16:37:07) [GET]
Session ID: 46bc01b9c60e58c44fad654fefa14006
Parameters: {"action"=>"index",
"controller"=>"carts/store",
"source"=>"test"}
NoMethodError (undefined method `total_price'' for nil:NilClass):
-------------------------------------------------------
However, on any subsequent runs everything works smoothly. Only when the
process expires do things get messy again.
Here''s the breakdown of my controller logic:
-------------------------------------------------------
ApplicationController:
CartsController < ApplicationController
- runs the hijack_db method using a before_filter
StoreController < CartsController
- creates a Cart object based on the session in the database.
- executes the .total_price method on this Cart object.
-------------------------------------------------------
My assumption is that the CartsController would run the hijack_db method
and obtain a connection before anything in StoreController is run. But
it seems that StoreController is beating CartsController to the punch.
If anybody has any idea''s on how I can force CartsController to run
first, can keep the application alive or could boot it up before use, or
has any good reading on any of these subjects it''d be greatly
appreciated! Thank you.
SERVER SETUP: Apache with FastCGI, MySQL for the database. Rails 1.1.6.
The app is using ActiveRecordStore for sessions.
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk
-~----------~----~----~----~------~----~------~--~---