views:

367

answers:

1

What's the best way to add a flash message, for successful or unsuccessful login when using the merb-auth slice (Other than overriding sessions create)?

+2  A: 

Hey deimos. If you want to add an message without overwriting the create action you can always use an after filter. Something like

...........

after :set_login_flash, :only => [:create]

private
def set_login_flash
  flash[:error] = "You're not logged in" unless logged_in?
end

..........

You'll need to tune it to use the appropriate flash system that you're using in your application but something like that should work for you.