# Rails 2 without a database?

**URL:** <https://www.ruby-forum.com/t/rails-2-without-a-database/129701>\
**Category:** Rails\
**Created:** [February 20, 2008, 8:48pm UTC](https://www.ruby-forum.com/t/rails-2-without-a-database/129701 "2008-02-20T20:48:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![atraeyu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/b19c9b/32.png) [@atraeyu](https://www.ruby-forum.com/u/atraeyu)\
**Post date:** [February 20, 2008, 8:48pm UTC](https://www.ruby-forum.com/t/rails-2-without-a-database/129701/1 "2008-02-20T20:48:16Z")

</div>

I’ve written a RESTful web service using Rails 1.2 and now I’m trying  
to upgrade to Rails 2.0, but it seems to insist that I have a database  
configured. Previously I had the following code in  
config/environment.rb and that seemed to be sufficient:

def config.database\_configuration  
class \<\< ActiveRecord::Base  
def establish\_connection(spec = nil)  
nil  
end  
end  
nil  
end

After the upgrade, running rake test:units results in a  
ActiveRecord::ConnectionNotEstablished because the abstract connection  
adapter in AR was trying to retrieve the current database connection.  
So overriding establish\_connection no longer appears to work in Rails  
2.

Then I saw that adding this to environment.rb would apparently do the  
trick:

config.frameworks -= [:active\_record]

But alas, doing that causes missing dependencies for active\_support  
and other plugins, so that won’t work either.

Aside from biting the bullet and using sqlite, is there a way to  
configure Rails 2 so that it will not use a database?

Thanks

n

---

<div class="post-metadata">

**Author:** ![atraeyu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/b19c9b/32.png) [@atraeyu](https://www.ruby-forum.com/u/atraeyu)\
**Post date:** [February 21, 2008, 11:29am UTC](https://www.ruby-forum.com/t/rails-2-without-a-database/129701/2 "2008-02-21T11:29:07Z")

</div>

On 20 Feb 2008, at 19:47, Nathan F. wrote:

> Then I saw that adding this to environment.rb would apparently do  
> the trick:
> 
> config.frameworks -= [:active\_record]
> 
> But alas, doing that causes missing dependencies for active\_support  
> and other plugins, so that won’t work either.

That works fine for me - i’ve got two databaseless applications.  
Presumable you don’t need any plugins which require AR so you could  
just remove them ?

Fred

> Aside from biting the bullet and using sqlite, is there a way to  
> configure Rails 2 so that it will not use a database?
