Well I really wanted to have inheritance on activerecord based classes (with db tables saving common data in base class and concrete data in subclasses). Sad to know rails can't do it. I'll try to do what I need with a different logic.
Thanks a lot for your help Fred :-) On Sep 13, 2:32 pm, Frederick Cheung <[email protected]> wrote: > On Sep 13, 11:15 am, Javier Ruiz <[email protected]> wrote: > > > Ok, then maybe I didn't ask properly... you are right it's not STI what > > I'm trying to do, but I'll try to explain it better. > > > What I need is just to extend a base class (wich is a model with its db > > table and all activerecord logic) with another class (a subclass with > > its own table and all activerecord logic, plus the parent methods, > > properties and so on). I tried to do it like I mentioned in my first > > email, but when the child class (the extended class) has a fk to another > > table, rails tries to find the fk in the parent class, not in the > > extended class, like the example I posted before: > > Rails doesn't do that - either the parent class is abstract (ie has no > table) or you get STI. You might have better look putting the common > functionality in a module, or having an abstract class which is the > parent of your 2 concrete classes. > > Fred -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

