Hi Luca

First, I'll explain what the chainable allows, then I'll explain how it does it.

A method defined in a chainable block can be overridden in the same
class (not a subclass) and still be called using 'super'.  Normally,
defining a method again completely overrides it and doesn't allow
super to be called.  This is important for things like attribute
accessors for properties, which people often want to override (e.g. to
change a value before its persisted) but still want the original
functionality.

It does this by creating an anonymous module which has the method
defined on it, and then including this module into the class.

I hope this helps!

Regards
Jonathan

On 8 January 2011 07:05, Luca B <[email protected]> wrote:
> Hello,
> I'd appreciate your help to understand the use of Chainable: why are
> certain methods defined inside a call to chainable?
> Thanks a lot,
> LucaB
>
> --
> You received this message because you are subscribed to the Google Groups 
> "DataMapper" 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/datamapper?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"DataMapper" 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/datamapper?hl=en.

Reply via email to