Exams Attended

Mock Exams

Make Homepage

Bookmark this page

Subscribe Email Address

Ruby On Rails Interview Questions and Answers

Ques. What is Flash in Ruby on Rails?

Flash  is simply a way to pass some value to the next action. 

Anything you place in the flash will be exposed to the very next action and then cleared out.

Here’s an example:

def destroy

section = Section.find(params[:id])      
redirect_to(:action => 'list', :page_id => @page.id)    


Then wherever you want to use the flash you can write this code. I often put this snippet in the application.html.erb file, somewhere towards the top:

   <% if !flash[:notice].blank? %>         
<div class="notice">  
 <%= flash[:notice] %>
Is it helpful? Yes No

Most helpful rated by users:

©2021 WithoutBook