11155
(-- --)
August 21, 2010, 5:35pm
1
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
ajey.potdar
(ajey.potdar@gmail.com)
August 22, 2010, 8:08am
3
In View have you added <%= flash[:notice] %>
and <%= javascript_include_tag :defaults %>
11155
(-- --)
August 22, 2010, 1:26pm
4
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
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