开发者

Remove Devise Flash Notices for Sign out

开发者 https://www.devze.com 2023-04-03 23:18 出处:网络
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 o

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 ther开发者_运维知识库e 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


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: ''


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
0

精彩评论

暂无评论...
验证码 换一张
取 消