Re: Object freeze and data reading

2017-01-16 Thread David Espada
2017-01-13 16:22 GMT+01:00 Jeremy Evans : > Are you running the current version of Sequel? I remember fixing an issue > like this sometime in the past. The line number you give doesn't really > make sense to cause the issue in the current code. If you are running the >

Re: Object freeze and data reading

2017-01-16 Thread David Espada
2017-01-16 21:40 GMT+01:00 Jeremy Evans > Thanks. This does appear to be a bug, caused because the associations > hash was frozen before validation (freeze validates), when it probably > shouldn't be frozen until after. > .../... > You could work

Re: "delay_add_association" plugin and one_to_one relationship

2016-09-01 Thread David Espada
2016-09-01 10:34 GMT+02:00 David Espada <da...@abstra.cc>: > > 2016-08-31 18:40 GMT+02:00 Jeremy Evans <jeremyeva...@gmail.com>: > >> plugin :instance_hooks >> >> def association=(v) >> after_save_hook{super} >> end >&g

Re: "delay_add_association" plugin and one_to_one relationship

2016-09-01 Thread David Espada
2016-08-31 18:40 GMT+02:00 Jeremy Evans : > That's certainly not the behavior of delay_add_association in the *_many > association case, so it wouldn't make sense for it to be the default in the > one_to_one case. If you want that behavior, you can probably write your >

Re: "delay_add_association" plugin and one_to_one relationship

2016-09-01 Thread David Espada
2016-09-01 10:51 GMT+02:00 David Espada <da...@abstra.cc>: > I have tested and it doesn't wotk :( > Ouch! Now I understand that your example is not generic code, but a redefinition of specific association code. Sorry :) -- David -- You received this message because you ar

"delay_add_association" plugin and one_to_one relationship

2016-08-31 Thread David Espada
Hi all. There is a good little Sequel plugin called "delay_add_association" that avoids persistence when adding a child (one_to_many) to an entity. That is good in my system, because I like to have a consistent object representation without persisting nothing until the end of the work cycle. But

Object freeze and data reading

2017-01-13 Thread David Espada
Hi all. I have a little problem reading data objects inside a frozen object. If I have a one_to_many relationship between Foo and Bar models, this code fails without a good reason (IMHO): foo.freeze foo.bars Problem is in line lib/sequel/model/associations.rb:1791 of Sequel code. Any clue

Eager loading models

2020-08-18 Thread David Espada
Hi everybody. If I have this simple model: -- class Operator < Sequel::Model one_to_many :directions end class Direction < Sequel::Model many_to_one :operator end -- I'd like to load an operator with all their directions in one quey. How can I do it

Synthetic fields

2021-10-13 Thread David Espada
Hi. I need to define a synthtic field for a Sequel::Model source dataset. I'd like getting a sum field with any Model query. How can it be done? Thank you very much. -- David -- You received this message because you are subscribed to the Google Groups "sequel-talk" group. To unsubscribe

Re: Synthetic fields

2021-10-19 Thread David Espada
El miércoles, 13 de octubre de 2021 a las 15:43:39 UTC+2, Jeremy Evans escribió: > On Wed, Oct 13, 2021 at 1:49 AM David Espada wrote: > >> Hi. >> >> I need to define a synthtic field for a Sequel::Model source dataset. I'd >> like getting a sum field with any M

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