# Can Rails render pages if there is no database connected?

**URL:** <https://www.ruby-forum.com/t/can-rails-render-pages-if-there-is-no-database-connected/55669>\
**Category:** Rails\
**Created:** [January 2, 2006, 1:18am UTC](https://www.ruby-forum.com/t/can-rails-render-pages-if-there-is-no-database-connected/55669 "2006-01-02T01:18:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Duane\_J](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e19adc/32.png) [@Duane\_J](https://www.ruby-forum.com/u/Duane_J)\
**Post date:** [January 2, 2006, 1:18am UTC](https://www.ruby-forum.com/t/can-rails-render-pages-if-there-is-no-database-connected/55669/1 "2006-01-02T01:18:23Z")

</div>

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 J.  
(canadaduane)  
[http://blog.inquirylabs.com/](http://blog.inquirylabs.com/)

---

<div class="post-metadata">

**Author:** ![Duane\_J](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e19adc/32.png) [@Duane\_J](https://www.ruby-forum.com/u/Duane_J)\
**Post date:** [January 2, 2006, 6:52am UTC](https://www.ruby-forum.com/t/can-rails-render-pages-if-there-is-no-database-connected/55669/2 "2006-01-02T06:52:57Z")

</div>

On Jan 1, 2006, at 4:00 PM, Duane J. 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 J.  
> (canadaduane)  
> [http://blog.inquirylabs.com/](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 Z.  
WebMaster  
Yakima Herald-Republic Newspaper  
removed\_email\_address@domain.invalid  
509-577-7732

---

<div class="post-metadata">

**Author:** ![Duane\_J](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e19adc/32.png) [@Duane\_J](https://www.ruby-forum.com/u/Duane_J)\
**Post date:** [January 2, 2006, 11:44pm UTC](https://www.ruby-forum.com/t/can-rails-render-pages-if-there-is-no-database-connected/55669/3 "2006-01-02T23:44:34Z")

</div>

> 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 🙂
