does anyone know how to prevent the failing mechanism of
f.e.: I have my page navigation with
link_to_unless_current “new task”, new_task_path
When I click on the link, i come to the new taks path form… And no
link is created -> ok. Then I put incorrect values in the form and
The TasksController processes the “create” action, the validation for
the ActiveRecord-model fails because of the incorrect data and the
controller renders the “new” action (and includes the error messages
for the model).
class TasksController < ApplicationController
@task = Task.new(params[:task])
if @task.save flash[:notice] = 'task was successfully created.' redirect_to(tasks_url) else render :action => "new" end end
But here the link gets created! -> Because of the difference between
link path = new_task_path
posted path = tasks_path with :method => :post
Does anybody know how to cleanly solve this problem?