Forum: Ruby different id_field

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.
65d5822c31ba70aa39b72352a61d90bf?d=identicon&s=25 Sushrut Sathe (sushrut)
on 2009-04-03 17:13
Hi,
In my table there is no id field,i.e. I have the field with the name
id_host
then how to use that field in my application without changing the field
name.
D68c97e8e2f1653b54c24493caf236ae?d=identicon&s=25 Stephen Celis (Guest)
on 2009-04-04 00:45
(Received via mailing list)
Hi,

On Apr 3, 2009, at 10:12 AM, Sushrut Sathe wrote:

> Hi,
> In my table there is no id field,i.e. I have the field with the name
> id_host
> then how to use that field in my application without changing the
> field
> name.


Assuming you mean Rails, you may have better luck next time asking on
their list. Try this:

  class ModelName < ActiveRecord::Base
    set_primary_key "id_host"
  end


- Stephen
This topic is locked and can not be replied to.