Just a simple question, I have followed the railscast
It's nice how for remote true works, but how can I validate the model ?
I have this one
<%= form_for [:admin,@course], remote: true do |f| %>
<div class="field">
<%= f.label :title, "The title:" %><br />
<%= f.text_field :title %>
</div>
<div class="field">
<%= f.label :description, "Descripcion:" %><br />
<%= f.text_area :description %>
</div>
<div class="actions">
<%= f.submit "Send"%>
</div>
<% end %>
How I handle the error?
def create
@course = Course.new(params[:course])
respond_to do |format|
if @course.save
format.html { redirect_to admin_index_url, :notice=> 'Done !!' }
format.js
else
format.html { flash.now[:alert] = "Not done"
render "new"
}
format.js
end
end
end
Any ideas why this does not work?