No I’m not talking Macromedia Flash which most people who know me would assume. I’m talking about the Ruby on Rails flash object. The flash object is a mechanism to pass information between different actions.
In my olden days of ColdFusion development we would pass information between requests using URL and hidden form variables. It became difficult to track these variables and added extra complexity with maintaining them. The best example I can give is passing an error message between page requests. Maybe you’ve dealt with the situation of having a login form post to a page to process the login. If the login was unsuccessful the application would redirect to the login page and display an error message. This was generally passed through the URL or hidden form fields.
RoR provides the flash object which is basically a temporary session object that lets you write and read data from it. It lives through a second request, just so you can read the data from it, and then the data is purged. This is perfect for maintaining error messages and simple status information. The question I’d like to ask is why didn’t I ever think of this when using CF?!?