I actually ran into this same issue sometime back. n the worst part
was that it took me even longer to figure out this was happening cos i
was saving multiple records and some just wouldnt go into the db and i
would have no idea. but i really think its a useful, and more
importantly, correct feature. before_create and before_save are meant
for things u wanna do to/with the record before db commit. If one of
those actions fail, u wanna know about it.
though wat u say about @user.valid?, @user.save,
@user.errors.full_messages does make sense. a built-in rails solution
to this?.. hmmm.. mayb raise a standard error for all callbacks when
false is returned?

On Jun 13, 4:53 am, pepe <p...@betterrpg.com> wrote:
> IMHO, what you are saying does not make much sense looking at it from
> the perspective of the intent of the feature. The documentation says
> that if the callback returns false the chain is halted and it is my
> understanding that it is provided for you/us as a feature in case it
> is needed. The fact that you wrote your callbacks not knowing about
> the feature and unfortunately (or fortunately, so you now know about
> it) some of them end in a statement that can return false does not
> make the way it works horrible, just not convenient because you
> already wrote your code not taking that into cosideration. I am sure
> that many RoR programmers enjoy what the feature does for them and use
> it on purpose.
>
> What you are saying could be compared to complaining when taking the
> key out of a car stops the engine if you didn't know it would occur.
> Well, that's just the way it works and many of us are thankful for
> that 'feature'. It saves us a lot of $$ in gas and possibly stops
> countless accidents.
>
> My 2 cents.
>
> Pepe
>
> On Jun 12, 11:43 am, Max Williams <rails-mailing-l...@andreas-s.net>
> wrote:
>
> > Matt Jones wrote:
> > > On Jun 11, 12:07 pm, Max Williams <rails-mailing-l...@andreas-s.net>
> > > wrote:
> > >> argghh.
>
> > > If you're returning false on purpose, you'll typically add an error to
> > > the current object (errors.add or add_to_base) to explain what
> > > happened. Otherwise, it can be a little mysterious...
>
> > > --Matt Jones
>
> > It's the returning false by accident that was the problem, though.  I've
> > now gone through my callbacks and added 'true' before the end, when i
> > don't want them to fail.  This seems kind of horrible.
> > --
> > Posted viahttp://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to