开发者

How to disable the database on Rails 3 for a webservice-based application

开发者 https://www.devze.com 2023-01-05 08:24 出处:网络
I am making an application that does not, as of now, require a database. So I want to disable it! I am making this with Rails 3beta4 with Postgres 8.4.x.

I am making an application that does not, as of now, require a database. So I want to disable it!

I am making this with Rails 3beta4 with Postgres 8.4.x.

In order to serve up a view, Rails 3 seems to need the database specified in database.yml to exist--why? I never checked this with Rails 2.3, but it seems silly that it should need to connect to the database if I don't pull any data from it. Whic开发者_如何学JAVAh means I never want to connect to the database at all for this application.


If you are creating a new application, you can use 'skip-active-record' to skip database configuration:

rails new my_app --skip-active-record


Go to config and make the following changes in the database.yml file

under the database development, comment out your database. This way controller will stop looking for the database.

Once you're ready to use your database, just uncomment the above.

0

精彩评论

暂无评论...
验证码 换一张
取 消