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?
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?
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
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.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs