Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails Devise with Couchbase

Setting up a new Rails app, and I'd like to use Couchbase 2.0 to store all data, and use Devise for user authentication, but I get an error in the ORM (object-relational mapping) meaning Devise doesn't know how to talk to Couchbase. Couchbase is a NoSQL datastore similar to Cassandra, so I wonder if maybe someone has configured Devise to work with Couchbase, Cassandra, or other NoSQL and can help?

Here's the simple rails app, created with

rails new myapp -T -O

Edited Gemfile, added

gem "couchbase"
gem "couchbase-model"
gem "devise"

Setup Couchbase config

rails generate couchbase:config and edited config/couchbase.yml with database connection info.

rails generate devise:install which created config/initializers/devise.rb

Looking at config/initializers/devise.rb, I see it automatically put in require 'devise/orm/couchbase'

rails generate devise User

Fails with:

/usr/local/rvm/gems/ruby-1.9.3-p362/gems/activesupport-3.2.10/lib/active_support/dependencies.rb:251:in `require': cannot load such file -- devise/orm/couchbase (LoadError)

There is no devise/orm/couchbase in the Devise lib.

If I change the couchbase orm line in config/initializers/devise.rb to

require 'devise/orm/active_record.rb'

I get a different error when I try to do rails generate devise User:

error couchbase [not found]

Any thoughts how to proceed, or is Devise just not ready for a Couchbase and/or NoSQL datastores?

like image 320
Crash Override Avatar asked Mar 07 '26 09:03

Crash Override


1 Answers

That's correct, no one has written an ORM adapter for Couchbase and the Devise gem just yet. I believe they only have a couple ORM's, ActiveRecord/SQL being the primary. You could use the Sorcery gem, which allows for integration/hacking and have that work with Couchbase. I haven't done it yet myself, but I was researching it the other day.

If I get a chance to make a guide for Sorcery, I will update this answer so you get a notification, or just follow me on twitter: http://twitter.com/scalabl3

like image 55
scalabl3 Avatar answered Mar 09 '26 22:03

scalabl3



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!