Forum: Ruby on Rails connecting model class to different column name other tn id

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
84161f131a41bf1b730a7a4fbfd9068d?d=identicon&s=25 Vaibhav Deshpande (vaibhavdeshpandemca)
on 2009-04-03 17:44
I am using the allready created tables in oracle  and connecting to the
ruby on rails model class, i used 'set_table_name 'table name' ' and it
gets connected but, i want to access its records and it has different id
field name as field_id, i want to access its record making field_id
field as my id field so that i can access its records but i dont want to
rename field_id to id sence, it has laks of records and my company is
using those records can any one sugust me the way to connect the model
to field_id column...plz help

Thanks in advance...
with regards,
60ddadf1a8a8ebac760e7e4cc1e342b3?d=identicon&s=25 Siddick Ebramsha (siddick)
on 2009-04-04 06:23
Use the set_primary_key method.
84161f131a41bf1b730a7a4fbfd9068d?d=identicon&s=25 Vaibhav Deshpande (vaibhavdeshpandemca)
on 2009-04-04 11:10
Siddick Ebramsha wrote:
> Use the set_primary_key method.

I used this method as follows

class Item < ActiveRecord::Base
  set_table_name 'item'
  set_primary_key 'id_field'

and now its working properly,
Thanks you,
for your good response!!!!!!
Keep responding me.....
This topic is locked and can not be replied to.