Authentication and Wiki

Hey, I'm trying as a test to make a simple wiki with RoR. I wanted to
use restful_authentication plugin, which creates a couple controllers,
one of which is the Sessions controller. It has all the 'logged_in?'
checks and the 'current_user' variable. However, I don't know how to use
another controller's variables/methods from within another controller.
Ie, in my Wiki controller, or in it's views, I can't make these sort of
calls to make sure the user is logged in. Can anyone guide me in the
right direction?

Tim Mcd wrote:

Hey, I'm trying as a test to make a simple wiki with RoR. I wanted to
use restful_authentication plugin, which creates a couple controllers,
one of which is the Sessions controller. It has all the 'logged_in?'
checks and the 'current_user' variable. However, I don't know how to use
another controller's variables/methods from within another controller.
Ie, in my Wiki controller, or in it's views, I can't make these sort of
calls to make sure the user is logged in. Can anyone guide me in the
right direction?

restful_authentication does provide all those extras, but they live in the .lib file, not in the controllers. You should be able to called logged_in?, current_user etc from any controller.

They key is to include the restful_auth lib in application_controller. As long as you do this, all the functionality will be available site-wide.

HTH

Matt

Aah, so in the application controller, just a quick 'include
"restful_auth"' at the top o' the file?

Tim Mcd wrote:

Aah, so in the application controller, just a quick 'include "restful_auth"' at the top o' the file?

I believe it's actually "include AuthenticatedSystem". When you run script/generate to make the restful_auth controllers, it will put that line at the top of the Sessions controller. The docs recommend you move it to the application controller so it's globally available.

HTH

Matt