existing devise paths become undefined after integration with refinerycms

297 views
Skip to first unread message

hau

unread,
Mar 16, 2013, 10:54:23 AM3/16/13
to refine...@googlegroups.com
I have an existing rails 3.2 application, where I use devise to provide user sign in function.  I use the activeadmin gem to provide administrative function.  Activeadmin also uses devise but in the AdminUser scope.  They both work fine with separate sign in paths and sign in forms.

However, after I integrated refinerycms to my application, the activeadmin login form cannot be accessed anymore.  The log said, "undefined method `new_admin_user_password_path' for #<ActionDispatch::Routing::RoutesProxy:0x007f4ddc3457c0>".  This happened when I pointed the browser to the path http://localhost:3000/admin.  Before refinerycms, visiting that path will redirect me to the activeadmin login form.

In addition, some of my application devise paths also have problems.  When I tried to access a protected controller action without signing in, I used to be directed to the login form, as the controller action has a before_filter of authenticate_user!.  But after integrating with refinerycms, I got in the log, "NoMethodError (undefined method `new_user_session_path' for #<Module:0x007f4ddc4ca5c8>)".  I think devise uses a failure_app to redirect to new_user_session when authenticate_user! fails.  However, I cannot put a main_app. prefix to that path, as it's inside devise.

In routes.rb, I mounted refinerycms on '/cms'.

For other devise links to sign in, sign out that I wrote in the view templates, I had to modify those paths by adding the main_app. prefix.  That works for links to login page.  But I got the second error (undefined new_user_session_path) by pointing the browser to http://localhost:3000/protected, where the controller has the authenticate_user! before action.

Could you help me fix this, so that:
1. when I access http://localhost:3000/protected, devise redirects me to my own login page.
2. when I access http://localhost:3000/admin (the path used by activeadmin), it redirects me to activeadmin's login page.
3. when I access http://localhost:3000/cms/refinery (/cms is the mount point of refinerycms), it redirects me to refinerycms's login page.


Reply all
Reply to author
Forward
0 new messages