I am creating a user via:
user = User.create attrs
Basically, it screws up by adding a ‘id’ field with value NULL which I am guessing evaluates as 0. So after the first user, I get an error that id must be unique. I can confirm that the attrs hash does not contain an ‘id’ field.
This is the generated SQL:
INSERT INTO `users` (`birthday`, `created_at`, `device_token`, `device_type`, `email`, `fb_id`, `first_name`, `gender`, `last_name`, `location`, `rstatus`, `updated_at`) VALUES ('1992-02-28 00:00:00', '2012-12-06 17:43:43', NULL, 'x86_64', 'adfas023@gmail.com', '12593646569', 'Test', 'male', 'Once', Test, 'Single', '2012-12-06 17:43:43')
What’s going on?
Thanks
Your
idcolumn should be auto-incrementing, and your migrations would normally ensure this is so. If you can’t/aren’t using migrations, then fix it manually.