I have a model Question with "question_id", "elapsed_time", "allowed_time" and "status" as its fields and a controller named Reporting that receive JSON containing questions and save it. ("question_id" is not related to any of my models)
So far there is no problem. Until I try to run some tests. I've an error when Rails is trying to load my Question's fixture :
ActiveRecord::StatementInvalid: SQLite3::ConstraintException: questions.created_at may not be NULL: INSERT INTO "questions
"
Here's my fixture :
one:
id: 1
question_id: MyString
app: MyString
guid: 1
status: 1
elapsed_time: 1
allowed_time: 1
and my model :
class CreateQuestions < ActiveRecord::Migration
def change
create_table :questions do |t|
t.string :app
t.integer :guid
t.string :question_id
t.integer :elapsed_time
t.integer :allowed_time
t.datetime :happened_at
t.integer :status
t.timestamps
end
end
end
Any idea ?