Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to configure Ruby on Rails with no database?

It would be convenient to use Ruby on Rails for a small website project that has no current need for a database. I know I could create an empty database in MySQL and go from there, but does anyone know a better way to run Rails without a database?

Thanks

like image 864
RobbieCanuck Avatar asked May 04 '09 18:05

RobbieCanuck


People also ask

Does rails need a database?

Just about every Rails application will interact with a database. The database to use is specified in a configuration file, config/database. yml. If you open this file in a new Rails application, you'll see a default database configuration using SQLite.

What DB to use for Ruby on Rails?

Ruby on Rails uses SQLite as its database by default, but it also supports the use of MySQL. SQLite is an excellent alternative to a traditional database like MySQL, but it has some limitations, particularly with regards to concurrency and scaling to a high load, which may make MySQL a better choice for your project.

Which database is used with Ruby?

SQLite is a default Ruby database – it comes in the package with Ruby itself. So good news – its integration takes only several commands. Note: the Linux package of Ruby comes with SQLite, so you can use commands to manage it.

Is it possible to use two databases in a single application in Ruby on Rails?

Rails now has support for multiple databases so you don't have to store your data all in one place. At this time the following features are supported: Multiple writer databases and a replica for each. Automatic connection switching for the model you're working with.


1 Answers

For Rails 3 and Rails 4:

Use -O(Capital 'O') or --skip-activerecord option to generate an application without a database.

rails new myApp -O

or

rails new myApp --skip-activerecord

This Answer is reshared from here


For Rails 5:

Use --skip-active-record option to generate an application without a database

Notice the extra hyphen '-' as opposed to previous Rails versions.

rails new myApp --skip-active-record

like image 87
RSK Avatar answered Sep 21 '22 18:09

RSK