Reputation: 191789
I'm trying to create a rails 4.0 app using CouchDB both locally and deployed on heroku. I have CouchDB installed and running locally and the Cloudant addon for heroku. Heroku complains that DATABASE_URL
is invalid at the rake assets:precompile
step. When I run this locally (as well as when I run rails server
) I get the obvious error:
Specified 'sqlite3' for database adapter, but the gem is not loaded
However, I don't want to use sqlite3
, I want to use CouchDB. For lack of a better known option, I'm using the couchrest_model
gem, and I have it in my Gemfile as gem 'couchrest_model'
. Their README goes on to say,
CouchRest Model is configured to work out the box with no configuration as long as your CouchDB instance is running on the default port (5984) on localhost.
I can understand why it wouldn't work with Heroku since I may need additional configuration (although I'm not sure what that would be -- I assume Heroku takes care of that automatically), but CouchDB is running on localhost:5984 on my own machine.
I have noticed that config/database.yml
has references to sqlite3
for development/test/production. If I comment these out, I get complaints not specifying any connection adapter.
What do I have to do to at least get the app running with CouchDB locally and ideally with Heroku as well?
Upvotes: 3
Views: 1644
Reputation: 4831
You should create a config/couchdb.yml
and set up your configuration something like below (check out Configuration section on the couchrest_model documentation
development:
protocol: 'http'
host: localhost
port: 5984
prefix: project
suffix: development
username: test
password: user
and for heroku, you might want to specify the Cloudant host
production:
protocol: 'https'
host: sample.cloudant.com
port: 5984
prefix: project
suffix: test
username: production
password: user
Something like that
Also, you need to get rid of Active Record
In config/application.rb
, delete require rails/all
and replace it with
require "action_controller/railtie"
require "action_mailer/railtie"
require "sprockets/railtie"
require "rails/test_unit/railtie"
In config/environments/development.rb
, comment out
# config.active_record.migration_error = :page_load
And then you should be able to delete config/database.yml
and remove sqlite3
gem without getting Active Record errors
Check out this SO post about disabling active record for rails 4 as well
Upvotes: 2