Migrate from restful_authentication to devise - ruby-on-rails

i've been using rails 2 for a project and restful_authentication with it. Recently, i changed that project to rails 3 and i found out about devise, that to my eyes seems a much better solution that restful_authentication.
Therefore, i decided that it would be a good idea to migrate to devise, but it seems that the procedure is pretty tedious and error prone. I would like to ask you if you know of any good resource that describes the procedure, because doing it from scratch is a bit of a hassle.

rails generate devise:install
rails generate devise User
rake db:migrate
That's all there is for now, you get routes and functionality like /users/sign_(in|out|up) from start.
Resources:
Railscasts "Introducing Devise"
Devise Readme
Example application

You can try Migrating from Restful Authentication to Devise, but so far nothing for me. :(

Related

Migrating from restful_authentication to Devise with Rails 2.3.14

I am in the process of using the rails upgrade plugin (https://github.com/rails/rails_upgrade) to bring the application from 2.3.14 to 3.2. The plugin identified "restful_authentication" as something that needed to be replaced. After some research I decided to try to migrate to Devise.
I started looking at https://github.com/plataformatec/devise/wiki/How-To:-Migrate-from-restful_authentication-to-Devise, the issue I ran into is that these instructions are not meant for Rails 2.3.14.
I can figure out how to make most of it work for 2.3.14, but the biggest block I have ran into is that I am not sure which versions of Devise, Devise-encryptable and other gems to use. Is there an simple way to check?
Alliteratively am I making a mistake in trying to migrate to devise before I upgrade, should it be done the other way around?
Re: Is there a simple way to check? The short answer is no.
To know what Devise gems to use, just follow the directions in the devise wiki - you just need devise and devise-encryptable according to the wiki.
Re: Which one to do first: Whatever you decide to do, its a good idea to have a stable branch before attempting an upgrade. So either you a) upgrade Rails + get restful_auth working, or b) use Devise + upgrade Rails - just avoid trying to do both at the same time.
a) seems possible if you use https://github.com/Satish/restful-authentication . It's a fork of the original project, and neither are as active as Devise ( https://www.ruby-toolbox.com/categories/rails_authentication ). You may choose to upgrade your authentication system to devise anyway, which leads us to...
b) probably the road-more-travelled. You should be able to find plenty of (Rails 2.3) upgrade instructions for restful_authentication->Devise. Get your specs green, then attempt the Rails 3 upgrade.

Rails 2.3.11 Administrator Gem

This is my first question here in StackOverflow :)
I've been searching for the best plugin for administrator for my Rails 2.3.11 app.
I can create my own but I have to rush my project so I decided to use these kinds of plugin.
I already searched rails_admin and active_admin. There are both good but I think that's for Rails 3 only. So I need to find some admin plugins for Rails 2.3.11.
Your ideas are much welcome :) Thanks!
Give Typus a try. It works on rails 2.3 and is quite popular, although the author isn't planning on maintaining the 2.3 version anymore.
https://github.com/typus/typus/wiki/requirements

undefined method `devise_for' in rails

After I install devise and create a user model. I rake db:migrate and then I rake routes. I then get a error with "undefined method `devise_for' for #". What could be causing this error?
Remember to restart your rails server after installing and configuring devise.
If you have the Devise gem specified in the Gemfile, just make sure you have the following in your routes.rb file:
devise_for :users
Also, here's a trick to make sure Devise is mapped properly, run: rails c, (the Rails app console) in your app's folder and then the following command line:
Devise.mappings.keys
You should see:
=> [:user]
Cheers!
Honestly, I would recommend following these two Railscasts (Episode 209 and Episode 210). The first is a simple and very easy walkthrough for installing Devise and the second is about customizing it to fit your application.
I've watched both episodes and they drastically helped me with Devise, particularly with the customization.
Your best bet is to start from scratch - you'll learn a heck of a lot and have Devise fully installed and functional.
Hope this helps! Good luck.
You may need to do a bundle install

Admin Plugins For Rails

I'm looking for a good admin plugin/gem for a Rails 3 application. I have tested rails_admin and it seems very good. Has anybody used any other plugins for Rails 3.0?
Also has anybody had any issues with rails_admin?
A lot of options, at the moment. Check all of them out here.
http://ruby-toolbox.com/categories/rails_admin_interfaces.html
I have heard both admin_data and typus are good.
Using Rails Admin too. Never had a problem.

Any working tutorials for Authlogic?

I've been trying to build my first rails app and have gotten stuck on the issue of user authentication. I've found a number of tutorials for using various plug-ins to do this, but so far every single one of them is out-dated, and as a result, broken!
From what I've read, I think Authlogic may be the best fit for me, and I've tried two things:
1) Going through Railscast, episode #160 (which is a tutorial for setting it up)
2) Using Ryan B's nifty_authentication gem with the --authlogic tag
In both cases, I get the following error as soon as I try to do anything with a user:
undefined local variable or method `acts_as_authentic' for #
I believe this is from the User model:
class User < ActiveRecord::Base
acts_as_authentic
end
I'm sure I've installed the authlogic gem, and I've added
config.gem "authlogic"
to my environment.rb
Any ideas about what's wrong? Anybody know of a complete and up to date tutorial for adding user authentication?
Edit:
I'm running Ruby v. 1.8.6 and rails v. 2.3.5
There is one thing that Ryan Bates in the RailsCasts episode doesn't talk about is about creating sessions table in your database. Type rake db:sessions:create in the console and run the migration rake db:migrate. Also like ghoppe says run rake gems:install after installing the gem. That is a requisite.
Here's an example app with a step-by-step guide - it's from last year but should still be mostly if not entirely accurate:
authlogic_example
Since you added that line to your environment.rb, have you tried rake gems:install to ensure the gem is installed and working correctly?
Also, what version of Ruby? What version of Rails? Have you tried running gem environment and gem list to make sure they're installed and running from the right place?
Another option is to use authlogic as a plugin, with:
script/plugin install git://github.com/binarylogic/authlogic.git
It also helps to look at a projects that uses authlogic as authentication module, like the fat_free_crm project, have a look at user.rb there
Last but not least, there is an active mailing list:
authlogic mailing list
Becoming popular is also the devise gem. Here you can add authentication with script/generate devise and you will have some views for login as well.
I forked that authlogic_example and added activity_tracker, authlogic, paperclip for user profile images, declarative_authorization, and user to user messages.
http://github.com/jspooner/authlogic_cucumber_rspec_example

Resources