[katello-devel] Apipie and validation.

Ohad Levy ohadlevy at redhat.com
Mon Dec 3 12:59:21 UTC 2012



----- Original Message -----
| On 30/11/12 03:41 PM, Lukas Zapletal wrote:
| > On Fri, Nov 30, 2012 at 03:02:15PM +0000, Dmitri Dolguikh wrote:
| >> Repeat after me: validation logic belongs in the model.
| > Only in an ideal world, Dmitri. ;-)
| >
| > Not all our controllers follows REST pattern, and you know that.
| >
| This has nothing to do with rest - just common sense. If you start
| doing
| validations in controllers, you will inevitable start moving business
| logic to them.
| 
| In our case, instead of perpetuating the problem, let's fix it
| instead.
| Step #1 - let's get rid of controller validations.
| 

The good thing about the validations is that you can pass them along, for example to a client, so it does not need to make the round trip to figure out he needs another param.

I agree that I would prefer the model to raise the error, so should probably turn it off by default?

I would also look at https://github.com/bcardarella/client_side_validations for inspirations of how to get the model validations.

Ohad
| 
| _______________________________________________
| katello-devel mailing list
| katello-devel at redhat.com
| https://www.redhat.com/mailman/listinfo/katello-devel
| 




More information about the katello-devel mailing list