Tutorial :How to use restful_authentication in other controller login view?



Question:

i installed restful_authentication and its working, the login page allows me to login but i have another controller called admin and want to embed a login view inside the admin controller. Actually the url to the login view is : localhost:3000/login (it worked and i needed so that users can log in). I need : localhost:3000/admin/login (that contains admin views and its for admin and staff to log in). I want the admin/login view form_for to call :controller => restful_authentication, :action => authenticate. How to do that? TIA.


Solution:1

Your best bet is probably to use the default login controller restful_authentication provides and leave it where it is. This will allow you to more easily upgrade that plugin in the future. Then, if you want a separate login form either break the login form out into a partial for reuse or implement your own but point it to the same controller used by the default form. Finally, for implementing administrative requirements on certain controllers/actions, here is a good solution:

http://refactormycode.com/codes/20-restful_authentication-role-requirements


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »