(spun off from my problem with acts_as_attachment)
I’m seeing a problem where the id is not being set when a record is
saved. I set up a new, simple Rails app, with one database table. I
try this in the console:
~/RoR/testaaa john$ script/console
Loading development environment.
b=Book.new
=> #<Book:0x255cab4 @attributes={“name”=>nil}, @new_record=true>b.name=“asdf”
=> “asdf”b.save
=> trueb
=> #<Book:0x255cab4 @errors=#<ActiveRecord::Errors:0x24344ac
@errors={}, @base=#<Book:0x255cab4 …>>, @attributes={“name”=>“asdf”,
“id”=>0}, @new_record=false>
Now, I’m pretty sure that after saving the id should be set to the id
of the record. Looking at the db (sqlite in this case), the id is
being properly autoincremented and set:
~/RoR/testaaa john$ sqlite3 db/testaaa_development
SQLite version 3.1.3
Enter “.help” for instructions
sqlite> select * from books;
1|hsfd
Has anyone seen this? I’ve got up to date gems.
Thanks!