私は同じ問題を抱えていたため、あなたの質問に遭遇しました。あなたがafter_invite_path_forをオーバーライドするための意図した方法を教えることができる限り、Devise :: InvitationsControllerをオーバーライドすることです。
class Users::InvitationsController < Devise::InvitationsController
def after_invite_path_for(resource)
new_profile_path
end
end
routes.rbを
devise_for :users, :controllers => { :invitations => "users/invitations" }
工夫のinvitableが適切考案し、その後にアプリケーションコントローラのパスを受け入れる/招待オーバーライドすることができますように働いた場合、それはいいだろう。そのように動作するようにdevise_invitableを変更し、プルリクエストを提出しました。私はそれが受け入れられるかどうかはわかりませんが、ここで見ることができます:https://github.com/scambra/devise_invitable/pull/240。
その機能が受け入れられた場合、あなたが招待/初期化子でこれを置くことによって、アプリケーションのコントローラ内のパスを受け入れた後の定義を尊重するinvitableの現在のバージョンにパッチを適用できます。
#make invitable's path functions overridable in application controller
[:after_invite_path_for, :after_accept_path_for].each do |method|
Devise::InvitationsController.send(:remove_method, method) if ApplicationController.method_defined? method
end
私はdevise_invitable使用しています上のパッチと同じですが、 'ApplicationController'のオーバーライドではまだ動作していないようです。 'Users :: InvitationsController'の' after_invite_path_for'をオーバーライドしても、リソースは正しくありません。私は著者に問題を再開するように頼んだ。 https://github.com/scambra/devise_invitable/pull/240#issuecomment-11915891 –