I believe the primary_key directive will tell AR what field to use as the 
actual PK.  Something like:

  class MyClass < AR::Base
    primary_key :actual_pk_field_name
  end

Hopefully AR would then then ignore the id field.

-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of pepe
Sent: Tuesday, May 26, 2009 9:11 AM
To: Ruby on Rails: Talk
Subject: [Rails] ID not primary key with not unique values


Sorry for the re-post. Nobody has even answered "no, can't do".

I have an ID column in a legacy table of type STRING and could contain not 
unique values. Is there a way of disabling the convention of ID being the 
primary key? How can I assign the values I need to the ID column without using 
SQL, which I already know would work?

ruby: 1.8.6
rails: 2.3.2
Database: Oracle 10g

Thanks.

Pepe


GHC Confidentiality Statement

This message and any attached files might contain confidential information 
protected by federal and state law. The information is intended only for the 
use of the individual(s) or entities originally named as addressees. The 
improper disclosure of such information may be subject to civil or criminal 
penalties. If this message reached you in error, please contact the sender and 
destroy this message. Disclosing, copying, forwarding, or distributing the 
information by unauthorized individuals or entities is strictly prohibited by 
law.

--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to