Scenario : You have some manipulation done in your controller action and redirect the user to another action after that. Now you want the output of the manipulation available in the page user is redirected to.
You can pass the object with redirect_to but that will be added as a query parameter. redirect_to is always a GET request and the params are always visible to the user.
To achieve this you can either store the stuff in the session and clear it once you are done or pass the arbitrary objects to the template using flash. Though its a poor practice, it serves the purpose.
flash[:new_flash_key] = object
redirect_to :action_name
<% flash[:new_flash_key].each do |key| %>
Posted by Sandheep to Sandheep's deck (2013-05-03 10:10)