Forum: Ruby on Rails Overriding inheritance_column

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.
31b6446447a4da5157bb67cc4c6afc64?d=identicon&s=25 John Kodis (Guest)
on 2005-12-21 01:40
(Received via mailing list)
I'm putting together a Rails application that will display information
from an existing database.  The database has a "job" table that
contains a "type" column.  I've successfully overridden the names of
the table and the name of the inheritance column by adding

    def self.table_name()
      'job'
    end
    Job.inheritance_column ='ruby_type'

to the job model, but then I'm unable to access the type field using
the same "<td><%= job.type %></td>" construct that works for all the
other fields in the .rhtml file.  This always yields a value of "Job".

I have to imagine that there's a simple way to gain access to the
value of the type column of the table, but nothing that I've tried so
far has worked.  If anyone has the magic incantation to do this I'd
appreciate hearing about it.

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