所以看来我一定做错了。
Task.create :name => 'apples'
(0.2ms) begin transaction
(0.2ms) rollback transaction
=> #<Task id: nil, name: "apples", task: nil, created_at: nil, updated_at: nil>
然后我想,也许我的控制器错了:
def create
Task.create(params[:task])
redirect_to tasks_path, :flash => {:success => 'We have created the task.'}
end
因为似乎我使用水豚的测试失败了-因为它们无法创建任务.....
想法?