Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails application without any database

Can we start (or) run a rails application without any database?

How can I do it?

like image 639
Kranthi Avatar asked Jul 13 '26 06:07

Kranthi


1 Answers

At the beginning of your config/application.rb file you should have something like this:

require File.expand_path('../boot', __FILE__)

# Pick the frameworks you want:
require "active_record/railtie"
require "action_controller/railtie"
require "action_mailer/railtie"
#require "active_resource/railtie"
require "sprockets/railtie"
# require "rails/test_unit/railtie"

When you remove this line:

require "active_record/railtie"

ActiveRecord will be gone and your app won't require a database connection.

You can also create the project with --skip-activerecord if it's a new one.

like image 125
Maurício Linhares Avatar answered Jul 14 '26 19:07

Maurício Linhares



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!