Hello. I would to replace a standard records idenfiers - 1,2,3,50043,43242 etc by a something like guid. I would like to use it everywhere - in assocations, etc, because i don''t wont to user estimate my database size by simple reading ids. Whats the solution? Is somewhere a rails plugin (i use rails 2.0.2)? I have problem with standard approach - by simple replacing id column by string and generate guid in callbacks - i use a postgresql database and my rails app raises some error with currval. Any solution? thanks -- 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 -~----------~----~----~----~------~----~------~--~---
Jan Kowalski wrote:> Hello. I would to replace a standard records idenfiers - > 1,2,3,50043,43242 etc by a something like guid. I would like to use it > everywhere - in assocations, etc, because i don''t wont to user estimate > my database size by simple reading ids. Whats the solution? Is somewhere > a rails plugin (i use rails 2.0.2)? I have problem with standard > approach - by simple replacing id column by string and generate guid in > callbacks - i use a postgresql database and my rails app raises some > error with currval. Any solution? thanksThis is not really a Rails issue. A surrogate primary key can be any data type and value so long as it is called id (or whatever key name format you have selected in your environment.rb) and the key values are unique and auto-generated by the DBMS. You will have to override the Rails postgresql adaptor defaults used for migrations of course. PostgreSQl 8.3 has a UUID data type and there are Postgres contributed libraries and modules for rolling your own uuid generators so I would recommend you start by reading the 8.3 docs on this data type. The posgres mailing list is a good source of support as well. -- 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 -~----------~----~----~----~------~----~------~--~---