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 declaration:

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

Answers


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)


Need Your Help

Remove object from Active Record Relation without deleting it

sql ruby-on-rails activerecord ruby-on-rails-4 relational-database

I'm working in Ruby on Rails 4 with Postgresql, and I've hit a bit of a snag. We have an Active Record model called AttendanceRecord which belongs to an AttendanceDay, AttendanceSwipe, Course, and

HTML::TableExtract not finding table

perl lwp

I'm having trouble with some code I've written. It's basically a proof of concept for myself and I'll be using it to run words through to get another form of it (fun Icelandic conjugation). In the ...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.