Flash message doesn't show up

In the controller method I have the following:

def create   @adv = Adv.new(params[:adv])   @adv.save   flash[:notice] = "Advertisement successfully created"   redirect_to "/advs/#{@adv.id}" end

When I create a new "Adv", I DON'T get the message: "Advertisement successfully created"

Why is that? What am I missing?

Thanks.

In the controller method I have the following:

def create @adv = Adv.new(params[:adv]) @adv.save flash[:notice] = "Advertisement successfully created" redirect_to "/advs/#{@adv.id}"

The code here is setting up the flash but you have to have code in the view to display it. What have you got in the view that you are showing after the redirect?

Colin

In View have you added <%= flash[:notice] %> and <%= javascript_include_tag :defaults %>

Thanks a lot everyone.

You are correct:

Yes, I have added "<%= flash[:notice] %>" in "application.html.erb"

I just want to ask, how can we make that notice with a different color and background? Should we do this manually by HTML for example?

Thanks.

Change the values in the selector in application.css

HTH, Bill

Bill Walton wrote:

Inline styling will certainly work but it has very much fallen out of favor. You will do yourself a favor, professional reputation-wise, by learning to use css selectors.

Best regards, Bill