Unobtrusive flash messages for RailsOctober 10, 2013 in Projects
I’d like to announce a gem that I wrote three years ago, then it got off my radar, albeit having some traction on RubyGems. I finally updated it to be compatible with recent technologies and also easier to use.
Firstly, it allows you to show Flash messages without having to render them inside your views. This allows views to be cached without worrying about stray flash messages cached within them.
Secondly, it lets you pass Flash messages along your AJAX responses, again, without affecting the response body. This allows you to add a bit of responsiveness to your AJAX calls without having to implement a custom notification system.
This is achieved with cookies, supported on any modern browser, and does not require more than 3 lines of configuration code. So it’s a great lightweight gem to add to your base application template. Now you don’t have to code anything to make flash messages appear!
The unobtrusive_flash page on Github has the instruction manual.