Forum: Ruby on Rails Re: Re: Re: Why can't I change value of the primary key?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Sean L. (Guest)
on 2006-05-17 22:16
(Received via mailing list)
>Let Rails have its Id column and create an old_id, or legacy_id, or
>customer_id, or whatever...and map it up.  :)

Yes, I agree.

Just treat the old key as an attribute of your new rails model. You
can use 'validates_uniqueness_of' to keep the old legacy key unique.

Rails follows convention over configuration. You can venture 'off the
rails', but you will have to carry more of the load yourself. Letting
rails do what it wants to do will probably work out as a simpler
solution for you in the long run.
This topic is locked and can not be replied to.