Thank you, it's very neat, I should have thinked about the simple "super" to 
call the overridden method

Inviato da iPod

Il giorno 29/nov/2010, alle ore 17:39, Jeremy Evans <[email protected]> ha 
scritto:

> On Nov 29, 6:22 am, Lorenzo <[email protected]> wrote:
>> Hi, I'd like to filter the input of a setter, I saw model hooks but in this 
>> case it won't fit well since the column will not be touched in most cases.
>> 
>> something like:
>> 
>> def foo=(param)
>>   self.foo = ...
>> end
>> 
>> wont work because ruby will call self until the nice error Stack level too 
>> deep. With DataMapper I could use set_attribute() method, is there an 
>> alternative for sequel, or i'll have to use a simple before_ hook?
> 
> With Sequel, it's even simpler, you just call super:
> 
> def foo=(param)
>  super(param * 2)
> end
> 
> In almost all cases in Sequel::Model, whenever you override a method,
> you just call super.
> 
> Jeremy
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "sequel-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/sequel-talk?hl=en.
> 

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

Reply via email to