Nithin Reddy
2006-Feb-24 23:59 UTC
[Rails] sqlite sets a new model''s id to 0 after a save
Example: car = Car.new car.id # is nil car.save car.id # is 0 I''m wondering if this is expected behavior, or something wrong with what I''m doing. If it is not expected behaviour, how do I go about solving it?
Matthew Routley
2006-Feb-25 15:34 UTC
[Rails] Re: sqlite sets a new model''s id to 0 after a save
Hello, I recently had this problem. According to http://wiki.rubyonrails.org/rails/pages/HowtoUseSQLite swig is required to use sqlite with rails. I used: sudo port install swig sudo gem install sqlite3-ruby which solved my id=0 problem. Perhaps you are having the same issue? Cheers, Matt
Nithin Reddy
2006-Feb-27 18:41 UTC
[Rails] Re: sqlite sets a new model''s id to 0 after a save
Your advice worked, thanks! I did have swig installed, but it was an older version. Without your suggesiton, I would have never thought to look into it. - Nithin On 2/25/06, Matthew Routley <matthew.routley@gmail.com> wrote:> Hello, > > I recently had this problem. According to > http://wiki.rubyonrails.org/rails/pages/HowtoUseSQLite swig is required to use > sqlite with rails. I used: > > sudo port install swig > sudo gem install sqlite3-ruby > > which solved my id=0 problem. Perhaps you are having the same issue? > > Cheers, > Matt > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >