23 Apr 2010

Upgrading Restful Authentication Plugin for Rails 3

Rails 3 posted by kapil

Here at Vinsol, we love to be on cutting edge of Ruby on Rails.

When I tried to use restful authentication generator plugin for Rails 3 app, I got ‘Could not find generator authenticated’ error. Generator system in Rails3 is now replaced with Thor which is a scripting framework that replaces rake and sake. Rails 2.x.x finds generators in generators/ or rails_generators/ directory of a gem or a plugin, but the new Thor based system looks for lib/generators/ or lib/rails_generators/ directory.

I forked the original restful-authentication plugin and did the necessary changes to make it compatible with Rails 3.0.0.beta3. Updated code is available at http://github.com/Satish/restful-authentication and the original project page is here.

Comments welcome.

Did you like this? Share it:

No related posts.

Related posts brought to you by Yet Another Related Posts Plugin.

  • RadarListener

    Just a small correction: Thor does not replace Rake. Thor is a tool used for generating templates, rake is a tool used for running things such as db:migrate and cucumber:ok.

  • Satish
  • http://rituonrails.wordpress.com Ritu Kamthan

    I think Restful Authentication itself is not so nice. We have better plugins/gem to use. Tried auth-logic or devise?

  • Cyberfox

    Thank you for this. Very, very much.

    @Ritu – Sure, there are much better plugins/gems/engines for new app development, but if you want to drag a Rails 2 app kicking and screaming into the Rails 3 world, you NEED this plugin updated, because it was the defacto standard for auth for a long time (in Rails time).

  • Tryinghard

    Satish, Thanks for the modifications.

    I was trying to migrate from the old version to yours, without luck, so I just removed the old one entirely and reinstalled. I get an error unfortunately:
    RoutingError: uninitialized constant ApplicationController::AuthenticatedSystem

    The files are in lib. Is some modification necessary to make this found?

  • Jonniefive

    Hi. I am experiencing the same error as Tryinghard below:

    “Routing Error
    uninitialized constant ApplicationController::AuthenticatedSystem”

    In application_controller.rb I have written “include AuthenticatedSystem”

  • Mick

    Hi, I am in the same situation than Jonniefive and Tryinghard. Any ideas ?

  • Mick

    I found a solution to this (I don't jnow if it is the best one) :

    “Routing Error
    uninitialized constant ApplicationController::AuthenticatedSystem”

    Solution : Just add this line at the top of your application_contoller.rb file :

    require 'lib/authenticated_system.rb'

  • Croplio

    error occured: no such file to load — lib/authenticated_system.rb
    I have to change to this instead:
    require File.join(Rails.root, 'lib', 'authenticated_system.rb')
    And it works for me.
    thanks Mick;

  • Vijay Ror

    pls add this line in your application.rb file: “config.autoload_paths << File.join(config.root, “lib”)”
    I think its works!

  • Travis

    Anyone have any ideas why all methods in my controllers except the destroy method use the session loggin while the destroy uses the login from cookie method?  It is really annoying and is the one thing keeping my Rails 2 app from being a Rails 3 app.

blog comments powered by Disqus