Sijo Kg wrote:
I would like to know how can i generate a model, without generating
the sequence table in postgresql…Currently for example when I do
create_table :table1 do |t|
A sequence is automatically generated like tables_id_seq
Thanks in advance
This can be done by using the :id => false option:
create_table :users, :id => false do |t|
However, I would highly recommend against doing this. With a few
exceptions. The primary one being join tables that use a compound
primary key composed of two foreign keys.
One important aspect of an ORM system like ActiveRecord is to have clear
object identity. I do everything I can to avoid using natural primary
keys, and I have VERY strong opinions about tables laking a primary key.
For a comprehensive overview that lines up nicely with my opinions here
is a well written article: