recreate Rails flash functionality