[Rails] before_save gotcha

Joe Youngquist
Fri, 10 Feb 2006 21:06:01 -0000

>not false is true.
true

I had too...its Friday :)


On 2/10/06, Pawel Szymczykowski <makenai@gmail.com>
wrote:
>
> On 2/10/06, Marcel Molina Jr. <marcel@vernix.org> wrote:
> > On Fri, Feb 10, 2006 at 12:46:18PM -0800, Pawel Szymczykowski wrote:
> > > Is it will known and accepted that before_save triggers should
return
> > > true? I didn''t notice this before but now I see it in
the
> > > documentation.
> >
> > It is not that they should return true, it is that they should *not*
> return
> > false.
>
> Yes - sorry, I worded that unclearly. In my head, anything not false is
> true. :)
>
> Still, it''s easy to accidentally return false when updating
boolean
> fields like that - it took me a while to track down too. I''m
afraid I
> may start putting a true at the end of all of my trigger callbacks out
> of sheer paranoia!
>
> -Pawel
> _______________________________________________
> Rails mailing list
> Rails@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>
-------------- next part --------------
An HTML attachment was scrubbed...