Topic: flash notice
Hey all,
Flash notice always appear even before user clicks submit button. Anyone have ideas why?
controller:
def index
@contact = Contact.new(params[:contact])
@contact.save if request.post?
if @contact.save
flash[:notice] = 'Contact was successfully created.'
end
end
end
form:
<% form_for :contact, @contact, :url => { :action => 'index' } do |f| %>
<%= f.text_field :first_name %>
<%= f.text_field :last_name %>
<%= f.text_field :organization %>
<%= f.text_field :email %>
<%= submit_tag "Create" %>
<% end %>
<% if flash[:notice] %>
<div class="notice"><%= flash[:notice] %></div>
<% end %>
Last edited by johnmerlino (2010-07-26 17:01:29)