Rails 4 Authentication using Devise with MongoMapper - devise

I am working on a Rails 4 app and would like to use MongoMapper and Devise for authentication. When I add devise to my Gemfile and bundle install it goes fine and I am able to rails g devise:install, and it picks up that I am using MongoMapper as my ORM. When I try to rails g mongo_mapper:config it says it cannot find the generator. Also I know that Devise supports Mongoid by default, but I like MongoMapper and would like to stick with that. I downgraded to Rails 3.2.14 and it seems to work fine. Any ideas on what I may be overlooking, or if Devise/MongoMapper support each other in Rails 4?

I got also errors using the generators to create a model for the devise user.
This worked after using:
gem 'mongo_mapper', '>= 0.13.0.beta2'
gem 'devise'
gem 'mm-devise'
and then in the devise.rb:
require 'devise/orm/mongo_mapper'
After that I did not got into any erros.

gem 'mongo_mapper'
gem 'devise'
gem 'mm-devise'
and also devise.rb should be
require 'mongo_mapper'

Related

how to configure Active admin support for mongoid and active record both?

I develop one application in rails which support mongodb CRUD and postgress CRUD its working with both database.
Now I like to make admin interface which communicate with both database. Mongodb and postgress.
I install below gem
gem "mongoid", "~> 4.0.0"
gem 'bson_ext'
gem 'activeadmin', github: 'gregbell/active_admin'
gem 'ransack', github: 'activerecord-hackery/ransack'
gem "activeadmin-mongoid", git: "git://github.com/elia/activeadmin-mongoid.git"
I configure active admin as describe below
http://activeadmin.info/docs/0-installation.html#initialize_active_admin
Now my active_admin work with mongodb model but not working with active_recode model
its give me below error
Don't know what context to use for AdminUser
Please help me support both database on active admin
MongoDB is not officially supported by ActiveAdmin version 1.0.0.pre1. I expect that someone will develop an adapter once ActiveAdmin reaches 1.0.

undefined local variable or method `config' for main:Object (NameError) when running rails server

Hi I've been following a tutorial for authlogic gem in railscasts... http://railscasts.com/episodes/160-authlogic?view=asciicast
From the tutorial, I was asked to add config.gem "authlogic" in my environment.rb
Is it the old way in installing a gem? or the right way to make authlogic work?
I removed the config.gem "authlogic" and tried to install the gem using gem install authlogic and by putting gem 'authlogic' inside my Gemfile (then bundle it)
Authlogic gives automatic form validation (when there's no input or what)
But it is not working. It could be possibly that I didn't install the authlogic gem properly?
What do you think is the problem why my Authlogic gem is not working..
Given the age of the Railscast, it's a good bet that the installation procedure is outdated. Luckily, the authlogic github page has not only updated install instructions (it is, as you'd expect and predicted, adding gem 'authlogic' to your Gemfile), it also has links to assorted tutorials and documentation. Hopefully you can use those to sort out your issue.

Neo4j.rb 2.0 and devise 2.0. Is there any way?

I want to use Neo4j database and JRuby on Rails to build a new web project. (I really need Neo4j or other graph database for this)
I am using neo4j 2.0 gem and trying to make authentication with Devise and Omniauth. Is there any way this combination will work?
I tried devise-neo4j but it is not compatible with neo4j.rb 2.0. I know that the last commit here says it is for neo4j.rb 2.0 but
gem 'neo4j'
gem 'devise-neo4j'
gives the following error when bundling:
Bundler could not find compatible versions for gem "neo4j":
In Gemfile:
devise-neo4j (>= 1.0.2) java depends on
neo4j (~> 1.1.1) java
neo4j (2.0.0.rc2)
I also tried the normal devise gem with neo4j:
gem 'neo4j'
gem 'devise'
but when I run rails g devise:install I get NameError: uninitialized constant User.
I searched and tried this a lot but couldn't get it working.
Does anyone know a good solution to this?
Or what is the right way to get this functionality (login with email/password and facebook,google,yahoo and twitter)? Oh, I know I can code it myself, but I would really like to use something already done.
My devise-neo4j fork is not released to rubygems.org, which means you have to specify it in the Gemfile file as:
gem 'devise', '1.5.3'
gem 'devise-neo4j', :git => 'git://github.com/andreasronge/devise-neo4j.git'
Notice that devise-neo4j does currently not work with devise 2.0.

wrong number of arguments (3 for 1) after upgrading rails from 3.1.1 to 3.1.3

I have upgraded my rails 3.1.1 application to rails 3.1.3, and now, on every request, it answers only wrong number of arguments (3 for 1). Unfortunately, it doesn't says where the error was, and application trace is empty. I think there's some compatibility problem, but I really don't know where to dig.
There are my Gemfile and a framework trace: https://gist.github.com/1519479
Thanks for any help.
Run bundle show and check version of omniauth gem. May be while upgrading rails you updated omniauth as well.
Version 1.* of omniauth requires separate gem omniauth-twitter for twitter authentication. As you don't have it in your Gemfile it tries to load as middleware Twitter class from twitter gem that would cause similar error.
To avoid issues like that in the future consider using "~> 0.2.6" for gems versioning instead of ">= 0.2.6". It protects you from unexpected major releases of gems you're using.

Attaching refinery cms to existing rails app version 3.1.1

I have an existing Rails app of version 3.1.1 and I am planning to add refinery cms to it. I have tried googling about it and have found few solutions.
I have placed following line in the gemfile:
gem 'refinerycms', :git => 'git://github.com/resolve/refinerycms.git'
On bundle install it is exiting in between giving the following output.
Bundler could not find compatible versions for gem "rails": In
Gemfile:
refinerycms depends on
rails (>= 3.1.3)
rails (3.1.1)
This is telling you that refinery needs at least version 3.1.3, while you're using 3.1.1. The changes between these two point releases are likely small enough that it should be a painless upgrade process.
Check whether you have rails version 3.1.1 specifically specified in your Gemfile and if so change it to gem "rails", "3.1.3".
Run bundle update rails