Results 1 to 2 of 2
Dec 19, 2006, 01:56 #1
- Join Date
- Aug 2004
- Novi Sad, Serbia
- 0 Post(s)
- 0 Thread(s)
[rails] Redirecting problem with grouped controllers
I have all my admin related controllers grouped under Admin (for example I have Admin::LoginController and Admin::CategoryController). When someone tries to access a protected controller he's redirected to login page and the page he requested is saved in session like this:
session[:goto] = request.parameters
The trivial solution for this problem is to change :controller value to an absolute path (i.e. '/admin/category') or to remove 'admin/' altogether, but that seems messy and also I am not quite sure how it would work if Rails app is not deployed in server root.
Does anyone knows any other way to do this?
Dec 19, 2006, 07:08 #2
The best way: Don't use namespaced controllers, use routing rules to add an /admin prefix to your non-namespaced controllers, and use regular :controller/:action/:whatever rules without worry since routes.rb will take care of it for you.
The way you might have to do it now because changing your app will take too long: Set the :controller value to '/admin/category'.