How do I make devise execute functions after sign up, sign in etc. I tried putting functions like this in my application controller.
class ApplicationController < ActionController::Base
private
def after_sign_up_path_for(resource_or_scope)
execute stuff
end
end
With my routes like this
devise_for :users do
get "/users/sign_out" => "devise/sessions#destroy", :as => :destroy_user_session
end
This doesn’t seem to do anything. I also tried making an sessions controller like so
class SessionsController < Devise::SessionsController
functions
end
With my routes like this
devise_for :users, :controllers => {:sessions => 'devise/sessions'} do
get "/users/sign_out" => "devise/sessions#destroy", :as => :destroy_user_session
end
This doesn’t seem to do anything as well, is there something I’m missing in making devise responsive. (I initially set up devise using this tutorial)
https://github.com/fortuity/rails3-subdomain-devise/wiki/Tutorial-(Walkthrough)
You can create your own
sessions_controllerwhich inherits fromDevise::SessionsControllerand override the actions you’d like to customize. For example, to perform some action after a user signs in, you could do:If calling
superis insufficient, you could reproduce the current implementation ofDevise::SessionsController#createin your controller. Then you have full control over what’s happening and can customize to tailor your exact needs. This may not be the prettiest solution, but might be necessary (at least to keep you going).