Satish / restful-authentication

Generates common user authentication code for Rails/Merb, with a full test/unit and rspec suite and optional Acts as State Machine support built-in.
http://weblog.techno-weenie.net
MIT License
82 stars 19 forks source link

Rails 3.0 RC1 #1

Closed cheolhom closed 14 years ago

cheolhom commented 14 years ago

Not sure what the issue is,

ActionController::RoutingError (uninitialized constant ApplicationController::AuthenticatedSystem): app/controllers/application_controller.rb:3:in <class:ApplicationController>' app/controllers/application_controller.rb:1:in<top (required)>' app/controllers/home_controller.rb:1:in `<top (required)>'

seems not to be able to find class ApplicationController < ActionController::Base

AuthenticatedSystem

include AuthenticatedSystem

osis commented 14 years ago

Same problem here. Just upgraded to RC1.

osis commented 14 years ago

After a lot of googling I finally found this:

Rails 3.0.0.rc won't autoload constant from the ROOT/lib directory anymore. This might or might not be intentional. Rails 3.0.0.beta4 was still autoloading constants from this directory.

It can easily be solved / worked around by adding this to your application.rb:

Custom directories with classes and modules you want to be autoloadable.

config.autoload_paths += %W(#{config.root}/lib)

cheolhom commented 14 years ago

@Osis confirmed that this fixes the issue.

Granit commented 14 years ago

I had the same problem. After adding to application config.autoload_paths += %W(#{config.root}/lib) (or require "#{config.root}/lib/authenticated_system" and require "#{config.root}/lib/authenticated_test_helper" ) another error happened:

ActionView::Template::Error (undefined method `value' for "":String):

This was solved by changing problem string ( lib/authenticated_system.rb:125 ) user = cookies[:auth_token] && User.find_by_remember_token(cookies[:auth_token].value) to user = !cookies[:auth_token].blank? && User.find_by_remember_token(cookies[:auth_token])

like it was in previos version of restful_authentication (http://github.com/technoweenie/restful-authentication/blob/master/generators/authenticated/templates/authenticated_system.rb , string 125)

puneetpandey commented 14 years ago

@Granit/@Osis

Thanks for your inputs. I applied the same changes, but it seems that page takes infinite time to load and FF is saying: "The page isn't redirecting properly" Any help would be highly appreciated.

Thanks in advance

puneetpandey commented 14 years ago

Sorry for the inconvenience, it is working now.... :)

I was including before_filter :login_required in application_controller.rb and that was preventing my page to get load.

Thanks a million for providing solutions.

Cheers!!