Rails devise custom urls
I'm aware that you can change the names of routes for devise, but I'm looking to actually add something to a devise route, like so:
match "users/sign_up/:invitation_token', :controller => 'registrations', :action => 'new'"
I've tried adding that line both directly above and directly below my devise routing declara开发者_如何学运维tion:
devise_for :users, :controllers => { :registrations => "registrations" }
But rails doesn't see the route. Is there a way that I can add a parameter to the devise generated URL?
Thanks
I'm assuming you're on rails 3 due to the use of the 'match' keyword. Try the following syntax
match 'users/sign_up/:invitation_token', :to => 'registrations#new'
Put this line below your devise_for
line and you should be good to go.
And since your goals is to manage invitations, you'll probably want to check out https://github.com/scambra/devise_invitable (haven't tried it myself)
Still I was getting some routing error. This worked for me:
devise_scope :user do
match "users/profile" => "sessions#show"
end
精彩评论