R
R
Ruslan Galiev2014-09-18 07:00:45
Ruby on Rails
Ruslan Galiev, 2014-09-18 07:00:45

Rails Devise+Cancan how to redirect a specific user role to a specific namespace?

Hello
There are 4 user roles. I make a separate namespace for each role.
Tell me where in the application and how, after determining the user's role, redirect him to a specific namespace. Moreover, it is desirable that the namespace is not reflected in the address bar in any way.
Those. Ideally, after authorization, the user opens, for example, the root_path is already his namespace. And in the address line there is nothing like server.name/namespace , but just server.name Is it possible to do this? Or does the definition of namespace always come from the address bar?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
Tonkonozhenko, 2014-10-22
@Tonkonozhenko

I somehow popped up in production such a thing.
Suppose there are 2 routes:

get '/home' => ''
get '/:id' => ''

If the first one threw an exception, then the second one was rendered
. Unfortunately, when I tried to reproduce it, it didn’t work.
Maybe it’s a rails 4.0 bug
PS: if you find the answer, write it down here, I’m also interested

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question