I have a table in sqlite that looks like this: CREATE TABLE appointments ( id INT PRIMARY KEY, person_id INT, apt_time DATETIME, repetition_type_id INT, duration INT, comments TEXT ); My ActiveRecord model looks like this: class Appointment < ActiveRecord::Base belongs_to :person end When I create a new appointment using the default scaffold create method it works, but it doesn''t save an integer in the id field. What do I need to do to emulate the behavior of mysql''s auto_increment field? Isn''t there something in rails that can take care of this for me? Thanks, Carl _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Carl Youngblood wrote:> I have a table in sqlite that looks like this: > > CREATE TABLE appointments > ( > id INT PRIMARY KEY, >[snip]> When I create a new appointment using the default scaffold create > method it works, but it doesn''t save an integer in the id field. What > do I need to do to emulate the behavior of mysql''s auto_increment > field? Isn''t there something in rails that can take care of this for me? >Read the relevant docs from sqlite, http://sqlite.org/lang_createtable.html and you will see autoincrement in there. - Adam
Thanks. I should have realized that. It has been a while since I last used sqlite. On 6/7/05, Adam Majer <adamm-+878OnfSgr5BDgjK7y7TUQ@public.gmane.org> wrote:> Read the relevant docs from sqlite, > > http://sqlite.org/lang_createtable.html > > and you will see autoincrement in there.