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
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.
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.
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.
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With