Bernerd,
Thanks for the pastie.  I have updated it to show there is more to do:
http://pastie.org/331557

Yes, my example was a beast.  I can keep pushing more into the model
(my old code had lots pushed into the model).  My point was to show
the expected flow in one place.

The pastie I modified from your example points out a few things:

first, these are times I want to validate just one or two attributes
prior to a save or a fetch.  For example, it is really dumb to fetch
the user from the DB only to find later that the input has password
and password_confirmed that do not match.  This thread about
exceptions has lots of talk about the overhead of exceptions.  I am
far more concerned about unnecessary DB calls.

second, involves the highly dangerous practice of mass assigns.  I
can't publish an app that allows any post params for my user object to
be swallowed whole.

all in all, I'm still not convinced that validation save me any work.
I need to guard every controller action input.  And I need to segment
the validations depending on the use case.  Not every use case demands
I check every attribute constraint.  This is IMO a flaw in the "rails
way".  Its not a know against DM, which I think is well coded.  I am
simply not convinced that as I go from "scaffold" to "robust" app,
that all this DRY-ness isn't getting me all washed up ;).

Thanks for the code.  It is good food for though and I may be able to
refactor some things with it.

Jon

On Dec 5, 12:15 am, "Bernerd Schaefer" <[EMAIL PROTECTED]> wrote:
> > Take a look at this for an example of doing something very simply without
> > exceptions:  http://gist.github.com/31904
>
> Jon,
>
> That example is quite the beast! :)
>
> Here's how I would handle that action:http://pastie.org/330980.
>
> Simple, clear, and -- most importantly -- takes the most advantage of
> DM: validations, named scopes, etc. Seems to me that exceptions would
> clutter up this action.
>
> Bernerd Schaefer
--~--~---------~--~----~------------~-------~--~----~
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