The flash notice message is not displaying " ruby on rails" -


i searched answer before came here found nothing. have in controller

def create     @article = article.new(article_params)     if @article.save         flash[:notice] = "article created"         redirect_to article_path(@article)     else         render 'new'     end end 

and add in application.html.erb:

<body>   <% flash.each |name, msg| %>     <ul>       <li><%= msg %></li>     </ul>   <% end %> <%= yield %> 

and here show.html.erb:

<h1>showing selected article</h1>  <p>   title: <%= @article.title %> </p>  <p>   description: <%= @article.description %> </p> 

after submitting form go show page,the flash notice not display. why?

i have github repo, seems not using application.html.erb layout, because article controller inherited actioncontroller::base

there 2 ways can this.

you can either change controller file inherit applicationcontroller:

class articlescontroller < applicationcontroller  end 

or can add default layout controller file:

class articlescontroller < actioncontroller::base layout 'application'  end 

hope solves problem.


Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -