Forum: Ruby problem with inheritance and "self"

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.
Ce8b03e5750097942c58e12b46724312?d=identicon&s=25 Giles Bowkett (Guest)
on 2007-02-07 01:36
(Received via mailing list)
I have three classes.


inside AbstractThing:

def self.get

(yup, it's a Rails app)

I want the DB to only have tables for blue_things and red_things --
but currently, this method gives me a search for abstract_things. The
reason is, the method dispatch pops up to super, finds the method, and
away we go.

How do I redefine this method so I only have to define it inside
AbstractThing, yet when I do, the method dispatch works in such a way
that BlueThing will look for blue_things in the DB, but do it using
AbstractThing's #get() method? In other words -- how do I get the
method to act not from within the superclass which defines it, but the
specific class which uses it?
Ce8b03e5750097942c58e12b46724312?d=identicon&s=25 Giles Bowkett (Guest)
on 2007-02-07 05:28
(Received via mailing list)
Just want to say, this turned out to be a Rails problem, not a Ruby
thing at all.
This topic is locked and can not be replied to.