The current approach is to specify a route using devise_scope :
devise_for :users, :controllers => { :invitations => "invitations" } devise_scope :user do match "/projects/:project_id/invitations/new", :to => "invitations#new", :via => "get", :as => "new_project_invitation" end
This means that I can use:
Case 1: users/invitation/new (to invite a new user to a web application)
and
Case 2: projects/:project_id/invitations/new (to invite a new user to a web application + project)
invitations_controller#new checks for the presence of :project_id and invokes the appropriate behavior for case 1 or 2.
source share