Single table inheritance , how to alias the id key name?

I have a model class Person < ActiveRecord::Base
and 2 classes inheriting from it
class User < Person and class Contact < Person

obviously the id is person.id
but is there anyway to use user.id and contact.id or should I
always use person.id ???

thanks for your suggestions

erwin

On 7 May 2008, at 14:27, Erwin wrote:

I have a model class Person < ActiveRecord::Base
and 2 classes inheriting from it
class User < Person and class Contact < Person

obviously the id is person.id
but is there anyway to use user.id and contact.id or should I
always use person.id ???

Your question doesn’t really make a huge amount of sent. If foo is an
instance of person, user, contact (or any other AR model for that
matter) the foo.id gives you the primary key

Fred

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs