Steps to get Devise Authentication and CanCan Authorization running on Ruby on Rails 2.3.5 with DataMapper and Bundler on Google AppEngine:¶ ↑
-
Install Devise version 1.0.6 as a plugin into the Rails vendor directory. Installing as a Gem did not work for me, maybe due to bundler (see this Issue: github.com/carlhuda/bundler/issues/issue/83, which involves patching Rails boot.rb etc.)
-
Add warden and cancan to your Gemfile
-
Configure Devise to use DataMapper as the orm in config/initializers/devise.rb
-
Setup ActionMailer as described in: gist.github.com/312532 in case you want confirmation of new users via email
-
Create a User model, which adds ActiveRecord-validations to the model in case the Devise validation-module will be used. If Devise validations will be used, DataMapper autovalidations should be disabled
-
If the rememberable module of Devise is used, the DataMapper-ORM (lib/devise/orm/data_mapper.rb) of Devise needs to be patched to use Time instead of DateTime. Otherwise an exception is thrown on setting the remember-cookie because of a missing .gmtime method
-
CanCan 1.1.1 runs out of the box, except for nested resources (e.g. comments belonging to posts). Patch controller_resource.rb to use DataMapper-get instead of ActiveRecord-find
great gist! thx!
I had problems with STI ( property :type, Discriminator in User model )
I've decided it by reloading routes in devise SessionsController
but I don't understand the heart of problem, have you any comment for it?