Sijo Kg wrote:> Hi
> I would like to know how can i generate a model, without generating
> the sequence table in postgresql..Currently for example when I do
>
> def self.up
> create_table :table1 do |t|
> --------
>
> A sequence is automatically generated like tables_id_seq
>
> Thanks in advance
> Sijo
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:
http://rapidapplicationdevelopment.blogspot.com/2007/08/in-case-youre-new-to-series-ive.html
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---