This article is part of the confusing world of Authentication in Rails. But [you can help][AuthenticationNeedsHelp], and hey, maybe there’s even some hope:
You’ve (probably) come to the right place. acts_as_authenticated seems to be the only sane solution if you’re looking for an authentication system generator for rails. Rejoice and use it!
Oh and you really want to see the *"official Acts As Authenticated Stikipad":http://technoweenie.stikipad.com/plugins/show/Acts+as+Authenticated *
I’ve been working with this one for awhile, but the documentation is rather sparse. After bugging kevinclark in #rubyonrails all evening, I decided to put this together. ‘AAA’ is my new favorite login framework, it seems the lightest and gets out of the way. It’s just tricky to get started.
In rails/:
ruby script/plugin source HTTP://svn.techno-weenie.net/projects/plugins
ruby script/plugin install acts_as_authenticated
ruby script/generate authenticated user account
This step will also generate the required migration for the user table: In rails/app:
rake db:migrate
Read through controllers/account_controller , models/user.rb and lib/authenticated_system.rb
Put include AuthenticatedSystem in your application controller (make sure you put it in the class, not before it), and put before_filter :login_required in every controller you want protected. More details in account_controller.rb.
To get to user info inside a controller or view (like, say, their login name):
current_user.login
To create a user account, go to http://localhost:3000/account/signup (or whatever your server is accessible)
You can get additonal help at http://technoweenie.stikipad.com wiki.
This almost worked instantly for me! I’m impressed. However, I did have to change line 11 of authenticated_system.rb to include User.find(session[:user])) instead of User.find_by_id(session[:user])), because Ruby wouldn’t recognize that function. Dunno why, I thought I had seen it before…
Also, I think this package could be even better if it included an “edit account” template.
Careful, User.find and User.findby_id are subtly different. find_by_id would return nil if it can’t find the user. find would raise an exception._
This article is part of the confusing world of Authentication in Rails. But [you can help][AuthenticationNeedsHelp], and hey, maybe there’s even some hope:
You’ve (probably) come to the right place. acts_as_authenticated seems to be the only sane solution if you’re looking for an authentication system generator for rails. Rejoice and use it!
Oh and you really want to see the *"official Acts As Authenticated Stikipad":http://technoweenie.stikipad.com/plugins/show/Acts+as+Authenticated *
I’ve been working with this one for awhile, but the documentation is rather sparse. After bugging kevinclark in #rubyonrails all evening, I decided to put this together. ‘AAA’ is my new favorite login framework, it seems the lightest and gets out of the way. It’s just tricky to get started.
In rails/:
ruby script/plugin source HTTP://svn.techno-weenie.net/projects/plugins
ruby script/plugin install acts_as_authenticated
ruby script/generate authenticated user account
This step will also generate the required migration for the user table: In rails/app:
rake db:migrate
Read through controllers/account_controller , models/user.rb and lib/authenticated_system.rb
Put include AuthenticatedSystem in your application controller (make sure you put it in the class, not before it), and put before_filter :login_required in every controller you want protected. More details in account_controller.rb.
To get to user info inside a controller or view (like, say, their login name):
current_user.login
To create a user account, go to http://localhost:3000/account/signup (or whatever your server is accessible)
You can get additonal help at http://technoweenie.stikipad.com wiki.
This almost worked instantly for me! I’m impressed. However, I did have to change line 11 of authenticated_system.rb to include User.find(session[:user])) instead of User.find_by_id(session[:user])), because Ruby wouldn’t recognize that function. Dunno why, I thought I had seen it before…
Also, I think this package could be even better if it included an “edit account” template.
Careful, User.find and User.findby_id are subtly different. find_by_id would return nil if it can’t find the user. find would raise an exception._