id must have a default nextval. The postgres adapter will deduce it if you
provide it.
Defining your tables with
id serial primary key
is the typical idiom.
Well, I read the source code of ActiveRecord::Base and the postgres-pr
adaptor and found out that the deduction you are referring to works
only for figuring out the id of the record just created:
Well, that’s ok, I’m fine with the rdbms taking care of incrementing
the pk, I just had false expectations about Active Record, because in
some O/R Mappers I used in the past (OJB) you can configure it to take
care of the PKs.
Well, problem’s solved, no, there’s no problem, I’m pretty happy with
ActiveRecord.
Yuri
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.