-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(Un)Authenticated Routes Are Broken in Rails 4.0.0.rc1 #2393
Comments
I've run into this issue as well. |
I was also having this problem. |
For now, you will need to give the second root a different named route:
|
That makes sense, not a bad solution for now. |
This is a Rails change of behaviour and Rails is not going back. I will update the docs accordingly. If you guys have seen this mentioned in the wiki, would you be kind to update the wiki too? Thank you! |
let me know,when i am using two devises how to use the routes for my user and admin models. unauthenticated do |
@mackgille just remember to use authenticated :user do
root to: "users#index", as: :authenticated_root
end
unauthenticated do
root to: "main#index", as: :unauthenticated_root
end |
@excid3 thanks a lot.it's working fine. |
I believe you meant:
|
Thanks for this. It might be worth noting to some newbies, like myself, that you must have at least one root entry un-named. Otherwise, you will start receiving "undefined local variable or method `root_path'" errors. |
Thanks for this solution, incase someone stumbles here trying to root unauthenticated users to the devise sign up view like me, I was able to do it this way.
|
This is work around for this kind of issue rails/rails#10418 heartcombo/devise#2393
Required by Rails upgrade. See heartcombo/devise#2393
The route name clashing functionality is causing the
authenticated
and related methods to break now since we cannot define multiple routes with the same name.The relevant commit in is this one rails/rails@822dd13 with a discussion in rails/rails#9704 and a good example of it here that crashes:
which raises this exception:
Even wrapping the second
root
clause withunauthenticated
didn't seem to do the trick like I thought it would. My thoughts are that having the following would be the best solution:Wasn't sure if this belonged as an issue in Devise or Rails though.
The text was updated successfully, but these errors were encountered: