So it seems that I must be doing this wrong.
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>
Then I thought, maybe my controller is wrong:
def create
Task.create(params[:task])
redirect_to tasks_path, :flash => {:success => 'We have created the task.'}
end
because it seems that my tests, using capybara, are failing – because they can’t create a task…..
thoughts?
You can’t save a Rails model to the database if it has a validation which fails, or a
before_savecallback which returns false