Forum: Ruby on Rails Can Rails render pages if there is no database connected?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
D8cb8c8cd40ddf0cd05241443a591868?d=identicon&s=25 Duane Johnson (Guest)
on 2006-01-02 01:18
(Received via mailing list)
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/
8e44c65ac5b896da534ef2440121c953?d=identicon&s=25 Ezra Zygmuntowicz (Guest)
on 2006-01-02 06:52
(Received via mailing list)
On Jan 1, 2006, at 4:00 PM, Duane Johnson wrote:

> (not even a GET is reported in the terminal where I have Lighttpd
> 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
6f7c877de704c7cc03c8a3b2dc52df92?d=identicon&s=25 Carmen --- (carmen)
on 2006-01-02 23:44
> 	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 hung

i 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 :)
This topic is locked and can not be replied to.