Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove Devise Flash Notices for Sign out

As the name says, I am using devise for user auth in a rails 3 app Upon user log out, there is a flash notice, "User Successfully signed out" that I don't want to appear. However, I can't figure out how to remove the notice.

Is there a way to get around just making it blank? I would like to completely remove the notice so that, ideally, there's not even an html div for notice

like image 327
Vasseurth Avatar asked Sep 12 '11 01:09

Vasseurth


2 Answers

My routes.rb

devise_for :users, :controllers => {
  sessions: 'user/sessions'
}

My controller "account/sessions_controller.rb"

class User::SessionsController < Devise::SessionsController

  def destroy
    super
    flash.delete(:notice)
  end

end
like image 22
Willem Avatar answered Oct 13 '22 01:10

Willem


If you explicitly put in a blank string for this in your locale file, then Devise "won't bother" to render the message at all (e.g. there won't even be an empty HTML div).

#en.yml
devise:
    sessions:
        signed_in: 'Signed in successfully.'
        signed_out: ''
like image 142
cailinanne Avatar answered Oct 12 '22 23:10

cailinanne