[LRUG] Base class for model

Simon Sebright simonsebright at hotmail.com
Sat Sep 12 10:49:21 PDT 2009


Thanks for the tip-off guys!
Cheers,
Simon

From: ollylegg at gmail.com
Date: Fri, 11 Sep 2009 16:20:11 +0100
To: chat at lists.lrug.org
Subject: Re: [LRUG] Base class for model



Yes, this is supported.
class MyBaseClass  self.abstract_class = trueend
class MySubClass < MyBaseClassend
http://api.rubyonrails.org/classes/ActiveRecord/Base.html
On 11 Sep 2009, at 16:17, Simon Sebright wrote:

Hi
 
I was attempting to do a bit of refactoring.  I had 
one model class, in which I had defined a few operations. Then along came a 
second one, where I wanted the same operations, so I started to create a common 
base class for them, which naturally inherits from 
ActiveRecord::Base
 
Now, I get all sorts of errors, and it looks like rails 
is taking the base class name and assuming it'll find a table relating to it, 
which in my case it won't.
 
Is this somehow supported, or should I be using a 
module/mixin instead?
 
Thanks,
Simon
_______________________________________________
Chat mailing list
Chat at lists.lrug.org
http://lists.lrug.org/listinfo.cgi/chat-lrug.org


_________________________________________________________________
Access your other email accounts and manage all your email from one place.
http://clk.atdmt.com/UKM/go/167688463/direct/01/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lrug.org/pipermail/chat-lrug.org/attachments/20090912/e9eeef31/attachment-0003.html>


More information about the Chat mailing list