Topic: ID ?

herez me next hurdle, I am sure most of the forum members have cracked this..

the id field in my database table is known by a different name, how can I let RAILS know of this?

Re: ID ?

figured this too

def id
        attr_name = self.class.primary_key
       column = column_for_attribute(attr_name)
       define_read_method(:id, attr_name, column) if self.class.generate_read_methods
       read_attribute(attr_name)
    end

Re: ID ?

this ones figured out too...take a look at my class

class AdfDmdgroupCollection < ActiveRecord::Base
   
   
    set_sequence_name "ADF_DMDGROUP_COLLECTION_SQ"
    set_primary_key  "adf_dmdgroup_collection_id"
   
end


I am liking ROR !

Last edited by srini_ge (2007-01-23 00:34:02)

Re: ID ?

There's a much easier way.

Try set_primary_key