I need to trigger callback before Devise redirects user to login page, probably because authenticate_user! method detected he’s not logged in. Something like:
before_filter :authenticate_user!, :only => :edit
def not_authenticated_callback
# do something
end
It shouldn’t be called if authenticate_user! has not been called.
I’ve found an ugly solution: