1.Install the plugin: script/plugin install http://svn.techno-weenie.net/projects/plugins/acts_as_authenticated
2. Generate the user and account models: script/generate authenticated user account
3. Rake the DB to add the users table: rake db:migrate
4. Finally, add this line to application.rb controller so you can use the gem: include AuthenticatedSystem
Type Url -http://localhost:3000/account/signup
Then you can see the sign up page
then you can see tha login page
To protect pages so they require login, simply add this line to the beginning of your controller class:
before_filter :login_required
If you want to exclude certain views from requiring authentication, just add the list of exceptions:
before_filter :login_required, :except => [:show]
def show
# view stuff ...
end
No comments:
Post a Comment