Duane Johnson
2006-Jan-02 00:00 UTC
[Rails] Can Rails render pages if there is no database connected?
I thought I knew the answer to this question (''yes''), however, recently I''ve been trying to build an app that detects whether or not the administrator has correctly configured the database. I''d like to give instructions in the negative case. So here''s where I''m at: if the database is configured, my app runs wonderfully; however, if the database doesn''t exist, or if the database login/password is incorrect, then Rails is completely unresponsive. When I load any page, I get a blank white screen. Checking the logs (even the server output) gives nothing at all (not even a GET is reported in the terminal where I have Lighttpd running). I created a simple Rails application from scratch ("rails simple" at the command line) and went to the index.html page. That worked fine; however, the ''About your application''s environment'' link shows nothing but a thin yellow line. Checking the URL that it goes to confirms that the same thing as described above is occurring: no response at all. Is this expected behavior, or is there something obvious I''m doing wrong that''s preventing my app from running without the database? Thanks, Duane Johnson (canadaduane) http://blog.inquirylabs.com/
Ezra Zygmuntowicz
2006-Jan-02 05:49 UTC
[Rails] Can Rails render pages if there is no database connected?
On Jan 1, 2006, at 4:00 PM, Duane Johnson wrote:> I thought I knew the answer to this question (''yes''), however, > recently I''ve been trying to build an app that detects whether or > not the administrator has correctly configured the database. I''d > like to give instructions in the negative case. > > So here''s where I''m at: if the database is configured, my app runs > wonderfully; however, if the database doesn''t exist, or if the > database login/password is incorrect, then Rails is completely > unresponsive. When I load any page, I get a blank white screen. > Checking the logs (even the server output) gives nothing at all > (not even a GET is reported in the terminal where I have Lighttpd > running). > > I created a simple Rails application from scratch ("rails simple" > at the command line) and went to the index.html page. That worked > fine; however, the ''About your application''s environment'' link > shows nothing but a thin yellow line. Checking the URL that it > goes to confirms that the same thing as described above is > occurring: no response at all. > > Is this expected behavior, or is there something obvious I''m doing > wrong that''s preventing my app from running without the database? > > Thanks, > > Duane Johnson > (canadaduane) > http://blog.inquirylabs.com/ > > >Duane- I have seen the exact same behavior for a few reasons. I get the blank screen in a fresh rails app just like you describe when the database isn''t connected or database.yml is not filled out. I also get it if I do something in environment.rb that doesn''t work like require a file that can''t be found. It seems like it rails kind of gets hung trying to load its environment so no errors go to any logs and you just get a white screen with no errors anywhere. The same thing can happen sometimes when you have stale old sessions in /tmp. I hate the empty screen, rails should have kittens when this happens and put errors in the logs or something. It can be a frustrating problem to debug as well. Anyway, I''m just confirming this behavior as I see the same thing you do. Cheers- -Ezra Zygmuntowicz WebMaster Yakima Herald-Republic Newspaper ezra@yakima-herald.com 509-577-7732
Carmen Rocco
2006-Jan-02 22:44 UTC
[Rails] Re: Can Rails render pages if there is no database connected
> I have seen the exact same behavior for a few reasons. I get the > blank screen in a fresh rails app just like you describe when the > database isn''t connected or database.yml is not filled out. > It seems like it rails kind of gets hungi find myself needing to killall -9 ruby18 and lighttpd and restart ./script/server whenever connectivity gets knocked out for a moment, either moving past a fridge which drops out wifi signal, or putting notebook to sleep. the error is always about a dead mysql connection, it seems it makes no attempts to reconnect.. this is with lighttpd running locally, and mysqld remotely (the other options, running the server remotely and automating a svn update via cron (nutty), editing the files of the remote server (ECB freezes up all of emacs on a connectivity loss due to locked NFS shares or something), or running lighttpd, AND the database on an underpowered notebook (overkill for the poor machine) were less desirable :) -- Posted via http://www.ruby-forum.com/.