I am using devise-invitable gem in my application. If the user exists in the application and he clicks accept invitation link he should be redirected to sign in page other if new user clicks the link he should be redirected to sign up page. I am not getting how I can override the after_accept_path_for method for that...Where and how can I override this method, can some one please help me in this? Following https://github.com/scambra/devise_invitable/ link
I think you might want to re-read the documentation, your question is answered in the docs, just not all in one place.
Here are the two sections that concern your question: https://github.com/scambra/devise_invitable#configuring-controllers https://github.com/scambra/devise_invitable#integration-in-a-rails-application
Basically you're going to add a controller for invitations and add routing information for that controller (app/controllers/users/invitations_controller.rb) like this:
class Users::InvitationsController < Devise::InvitationsController
def after_accept_path_for
"some path you define"
end
end
Then you'll change your routes.rb to tell devise to use your invitations controller like:
devise_for :users, :controllers => { :invitations => 'users/invitations' }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With