ruby on rails - Devise authentication: log out and redirect -
is there way write rails method log out , redirect custom page? i'm using devise authentication gem.
i not want logouts followed redirect, in place method called.
it depends on conditions have in order redirect 1 place or another, here in application redirect differently depending on role of user:
add private method in applicationcontroller:
private def after_sign_out_path_for(resource_or_scope) # if it's admin if is_admin?(current_user) admin_path # otherwise else root_path end end
basically, need find condition need apply in after_sign_out_path , return path accordingly condition. notice symbol scope, , therefore can use choose returned path redirect.
Comments
Post a Comment