Rails 4 WITH NO Database
, you may want to
a Rails app
without ActiveRecord or a database.
There might be situations like,
Your application only store data using third party APIs,
or storing in to files or
might not have any persistent data at all. Since Rails
common case (database backed app
to start the server without a database connection.
- Comment / Remove any database gems ( mysql, mysql2, sqlite, pg, mongoid, etc..) from your Gemfile and then run bundle.
your application.rb. By default, in Rails 4.0 you can see one line
which requires all of Rails:
This includes ActiveRecord also, and requires a database connection. Instead, you can include the specific parts of Rails that you gonna use.
default app generated by Rails 4.0 has one reference to active
record which must be removed, in config/environments/development.rb:
config.active_record.migration_error = :page_load
Now run your application with out any backend :)
4. Remove any references to active_record in your configuration