Fields in the wrong order when saving to sqllite3

Hi,

New to rails, and trying to make my first project work. When I try to save a new record to the sqllite database, I see that the SQL tries to insert the fields in the wrong order:

ActiveRecord::StatementInvalid in MembersController#create

SQLite3::SQLException: SQL logic error or missing database: INSERT INTO members ("secondary_city", "primary_adress", "updated_at", "primary_email", "primary_mobile", "secondary_telephone", "club_id", "secondary_zip", "gender", "is_active", "secondary_adress", "given_name", "secondary_email", "secondary_mobile", "primary_telephone", "date_of_birth", "primary_city", "primary_zip", "surname", "created_at") VALUES('', '', '2008-03-01 22:35:30', NULL, '', '', 1, '', NULL, 't', 'fdsdsf', 'Fredrik', NULL, '', '', '2008-03-01', '', '', 'Karlsson', '2008-03-01 22:35:30')

db zak$ sqlite3 development.sqlite3 SQLite version 3.4.0 Enter ".help" for instructions

.schema members

CREATE TABLE members ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "given_name" varchar(255) NOT NULL, "surname" varchar(255) NOT NULL, "date_of_birth" date DEFAULT NULL, "gender" integer NOT NULL, "primary_adress" varchar(255) DEFAULT NULL, "primary_zip" varchar(255) DEFAULT NULL, "primary_city" varchar(255) DEFAULT NULL, "primary_email" varchar(255) DEFAULT NULL, "primary_telephone" varchar(255) DEFAULT NULL, "primary_mobile" varchar(255) DEFAULT NULL, "secondary_adress" varchar(255) DEFAULT NULL, "secondary_zip" varchar(255) DEFAULT NULL, "secondary_city" varchar(255) DEFAULT NULL, "secondary_email" varchar(255) DEFAULT NULL, "secondary_telephone" varchar(255) DEFAULT NULL, "secondary_mobile" varchar(255) DEFAULT NULL, "is_active" boolean DEFAULT 't', "club_id" integer NOT NULL, "created_at" datetime DEFAULT NULL, "updated_at" datetime DEFAULT NULL);

How come the order of the fields are all wrong? I'm on 2.0.2.

/Fredrik

Hi,

Indeed the gender column was the problem. Thanks for all the help!

/Fredrik