From: Marcus Andersson Date: 2006-06-29T06:26:00+09:00 Subject: Re: How to model Hibernate multi-table inheritance with ActiveRecord? So far I have two solutions: 1) implement method_missing in Asset and delegate to [other]Asset where Asset cannot handle the requested method 2) implement method_missing in [other]Asset and delegate back to Asset where [other]Asset cannot handle the request (or a variant thereof) 1) gives easy querying (I can just query Asset for all objects) but I cannot override methods from Asset in [other]Asset. Not really good. This solution could be good if I could somehow make Asset ask [other]Asset if they have the requested method before calling the method in itself instead? Sort of like a default before handler on every method. 2) In order for this to work I always need to work on instances of [other]Asset. That in turns mean that I either have to make the query on [other]Asset class to get instances of [other]Asset or make the query on Asset and then start off by getting the [other]Asset instance from it and work with that (ie using Asset.find(:all).map(&:delegate_asset)). Neither of them feels really polymorphic. A solution here would be if one could bend ActiveRecord to return [other]Asset instead of Asset instances when querying the Asset class. I suppose this would be the solution to multi table inheritance though if I could solve it... What I'm after is a solution to make it transparet for the clients of the Asset class (and associates). I don't care how much/ugly code I have to hide in Asset to just make it transparent to the clients (since I have control over Asset, not over the clients). Have I missed anything? 2) sounds easy and good but I can't grip the querying situation (beyond what I described above). Have I missed something there? Thanks for the answers. /Marcus