Hello i have a quick question. I get 2 flash messages, the devise one and the scaffolded one. How can i just have the Devise message in the beautiful flash box only?
Here is my code for creating Products:
def create
@product = current_user.products.build(params[:product])
@product.user = current_user
respond_to do |format|
if @product.save
format.html { redirect_to(@product, :notice => 'Product was successfully created.') }
format.xml { render :xml => @product, :status => :created, :location => @product }
else
format.html { render :action => "new" }
format.xml { render :xml => @product.errors, :status => :unprocessable_entity }
end
end
end
products/show.html.erb:
<p id="notice"><%= notice %></p>
<p><b>Name:</b><%= @product.name %> </p>
<p><b>Date:</b><%= @product.date %></p>
<p><b>Price:</b><%= number_to_currency(@product.price) %></p>
<p><b>User:</b><%= @product.user_id %></p>
<p><b>Latitude:</b><%= @product.latitude %></p>
<p><b>Longitude:</b><%= @product.longitude %></p>
<p><b>Tags:</b> <%= @product.tag_list %></p>
<%= link_to 'Edit', edit_product_path(@product) %> |
<%= link_to 'Back', products_path %>
Thank you!
Do you have a ‘notice’ in your application.html.erb as well?
It may be best to put your notice & alert in there, instead of in all of your views anyway. Always good to refactor.