Re: Best option for validating all date fields in a model by default

2020-03-27 Thread Jeremy Evans
On Friday, March 27, 2020 at 3:07:45 AM UTC-7, David Espada Garcia wrote:
>
> Hi. 
>
> I use Sequel with Postgresql and I am getting a postgresql exception when 
> passing to any date field a value like "02:02:", because of "" 
> year. I'd like to catch those errors in all date fields by default. Which 
> is the best option for doing so? 
>

If you are using models, you would generally validate the data before use.  
I think the auto_validations plugin may cover that use case.

If you aren't using models, you would either check all data manually before 
submitting the query, or you would rescue the Sequel::DatabaseError and 
handle it appropriately.

Thanks,
Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sequel-talk+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sequel-talk/60507842-e66f-4093-b3a0-5e980af88eac%40googlegroups.com.


Best option for validating all date fields in a model by default

2020-03-27 Thread David Espada Garcia
Hi.

I use Sequel with Postgresql and I am getting a postgresql exception when 
passing to any date field a value like "02:02:", because of "" year. 
I'd like to catch those errors in all date fields by default. Which is the best 
option for doing so?

Thank yo very much.

--
David
Tanto este mensaje como todos los posibles documentos adjuntos al mismo, son 
confidenciales y están dirigidos exclusivamente a los destinatarios de los 
mismos. Por favor, si Usted no es uno de dichos destinatarios, notifíquenos 
este hecho y elimine el mensaje de su sistema. Queda prohibida la copia, 
difusión o revelación de su contenido a terceros sin el previo consentimiento 
por escrito Intermediación TARIC S.A.U.. En caso contrario, vulnerará la 
legislación vigente. Sus datos figuran en un fichero propiedad de TARIC S.A.U.. 
Puede ejercitar gratuitamente los derechos de acceso, oposición, rectificación, 
cancelación o supresión, revocación del consentimiento, portabilidad y 
limitación del tratamiento de los datos, dirigiéndose a TARIC S.A.U., C/ Boix y 
Morer, nº 6, de Madrid, con C. P. 28003.

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sequel-talk+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sequel-talk/SYBPR01MB4348F692D6209A41C404849FC9CC0%40SYBPR01MB4348.ausprd01.prod.outlook.com.