My Rails app is not deployed at the root level of my server (e.g. http://myserver.com). In order to be able to serve up multiple mongrel_clusters for multiple Rails apps, users must access the site at http://myserver.com/myapp/.
This caused one unforeseen issue with the restful_authentication plugin. After installing this plugin (or gem), a file named authenticated_system.rb is added to your app's lib directory. Inside that file is a method called 'redirect_back_or_default' that is used to redirect the user every time they perform a login or logout. This method in turn is then called by your Sessions controller (again, added by restful_authentication).
When I attempted to login or logout from my app, I was constantly redirected to the root level of our server instead of the root level of my app. This is obviously not what I wanted, and instead would prefer that users get redirected to the root URL for my app.
The 'redirect_back_or_default' method takes a default value as an input. So, to fix this, you simply need to modify your sessions_controller.rb file to include the proper default for your application. In my case, I replaced the '/' value that was included in the Sessions controller by default with the 'root_url' helper. Now when users logout, they return to the homepage of my application.
Friday, January 30, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment