[Rails] Active Record Question

Alexey Verkhovsky alex at verk.info
Wed Nov 10 17:26:38 GMT 2004


Tom Ward wrote:

>before_create is a callback method called before creation (a bit
>cleaner than overriding create).
>  
>
We've done it this way (mixin defining callbacks) in RForum, because I 
didn't want to spend time figuring out how to avoid the problems with 
the Inflector. Now we are about to change it to the abstract base class 
approach.

Reason: all the time you need to add other class-specific behaviors to 
those callbacks. With mixin it looks quite awkward. With abstract base 
class, much better.

There are some awkward incantations that you have to write in your 
abstract base class. See here:

http://rubyonrails.org/show/HowtoMakeAbstractModel

Best regards,
Alexey Verkhovsky


More information about the Rails mailing list