I am developing a support ticket system in Ruby and need to know if
there are any modules or anything that can be added to a project to
require a user to log in to the system first and then be allowed access
to the support ticket system.
If not, how would I go about verifying if a user is logged in before
being allowed to view the pages in the site?
there are several generators and plugins for authentication, although i
have not used any of them.
in your controller though, you should add something like
before_filter :check_authentication
with a protected check_authentication method in your controller. in
that, you can check to see if a use is logged in, if not, you can
redirect to your login page to prompt the user.
Thanks for the simple explanation. That helped a lot. However, I have
another question. You are setting the session[:user_id] in your
ApplicationController. How do I make that persistent throughout my
application? It does not appear to be setting the session variable as a
"global" option in the ApplicationController. When I click a link to
another :controller in the same application the other controller can't
retrieve that session information. Is there a trick I am missing?