ActiveRecord column "type"

Hi There…

I’m in a bit of a pickle. The thing is that I’m writing an
administrative rails application to handle the mysql data for a
application(PowerDNS to be exact.) However. The problem is that I 2
tables in there have the column “type” wich of course is a magic
column for single table inheritance.
I can set in my model the line
self.inheritance_column = “nothing”
and the script runs. However then of course I start getting ModelName
reportend when I try using model.type to get to the type column in the
data. Either I have to change the behaviour of .type or map .r_type to
the “type” column. I’m unsure which is the best way to go and how to
do it.

Jon Gretar B.
http://www.jongretar.net/

Found it out. type method is deprecated so it should be safe to remove.

in environments.rb
class Object
undef_method :type
end

in modelname.rb
class Modelname < ActiveRecord::base
set_inheritance_column “nothing”
end

On 11/1/06, Jon Gretar B. [email protected] wrote:

reportend when I try using model.type to get to the type column in the
data. Either I have to change the behaviour of .type or map .r_type to
the “type” column. I’m unsure which is the best way to go and how to
do it.

Jon Gretar B.
http://www.jongretar.net/

Jon Gretar B.
http://www.jongretar.net/

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