Re: "delay_add_association" plugin and one_to_one relationship
2016-09-01 10:51 GMT+02:00 David Espada : > 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 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 post to this group, send email to sequel-talk@googlegroups.com. Visit this group at https://groups.google.com/group/sequel-talk. For more options, visit https://groups.google.com/d/optout.
Re: "delay_add_association" plugin and one_to_one relationship
2016-09-01 10:34 GMT+02:00 David Espada : > > 2016-08-31 18:40 GMT+02:00 Jeremy Evans : > >> plugin :instance_hooks >> >> def association=(v) >> after_save_hook{super} >> end >> > > I'll try it. Thank you very much. > I have tested and it doesn't wotk :( I have not found any reference to association= method in Sequel code. What is the matter? I don't understand. -- David -- 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 post to this group, send email to sequel-talk@googlegroups.com. Visit this group at https://groups.google.com/group/sequel-talk. For more options, visit https://groups.google.com/d/optout.
Re: "delay_add_association" plugin and one_to_one relationship
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 > only plugin, or just do: > > plugin :instance_hooks > > def association=(v) > after_save_hook{super} > end > =8) Is this code valid for all association types? If so, great! I'll try it. Thank you very much. -- David -- 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 post to this group, send email to sequel-talk@googlegroups.com. Visit this group at https://groups.google.com/group/sequel-talk. For more options, visit https://groups.google.com/d/optout.
Re: "delay_add_association" plugin and one_to_one relationship
On Wednesday, August 31, 2016 at 7:50:48 AM UTC-7, David Espada wrote: > > 2016-08-31 16:00 GMT+02:00 Jeremy Evans : > >> I suppose that is something I would consider as an addition to >> delay_add_association. Do you want to work on a pull request for it? >> >> I have seen lightly the code and... it frightens me a little, but can try > it :) > > What I wish is having changed behaviour in all cases, when entity is new > and when is not. If you assign a related entity in ANY case, persistence > and linking is delayed until main (root) entity is persisted. What do you > think of that option? > 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 only plugin, or just do: plugin :instance_hooks def association=(v) after_save_hook{super} end 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 post to this group, send email to sequel-talk@googlegroups.com. Visit this group at https://groups.google.com/group/sequel-talk. For more options, visit https://groups.google.com/d/optout.
Re: "delay_add_association" plugin and one_to_one relationship
2016-08-31 16:00 GMT+02:00 Jeremy Evans : > I suppose that is something I would consider as an addition to > delay_add_association. Do you want to work on a pull request for it? > > I have seen lightly the code and... it frightens me a little, but can try it :) What I wish is having changed behaviour in all cases, when entity is new and when is not. If you assign a related entity in ANY case, persistence and linking is delayed until main (root) entity is persisted. What do you think of that option? Thank you. -- David -- 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 post to this group, send email to sequel-talk@googlegroups.com. Visit this group at https://groups.google.com/group/sequel-talk. For more options, visit https://groups.google.com/d/optout.
Re: "delay_add_association" plugin and one_to_one relationship
On Wednesday, August 31, 2016 at 4:36:40 AM UTC-7, David Espada wrote: > > 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 I have a problem for generalizing that behaviour with one_to_one > relations. > In that case I can't do assignation between entities avoiding persistence. > > Can we have a similar solution for one_to_one as in one_to_many? I think > that > consistent behaviour is good for Sequel practices :) > I suppose that is something I would consider as an addition to delay_add_association. Do you want to work on a pull request for it? 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 post to this group, send email to sequel-talk@googlegroups.com. Visit this group at https://groups.google.com/group/sequel-talk. For more options, visit https://groups.google.com/d/optout.
"delay_add_association" plugin and one_to_one relationship
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 I have a problem for generalizing that behaviour with one_to_one relations. In that case I can't do assignation between entities avoiding persistence. Can we have a similar solution for one_to_one as in one_to_many? I think that consistent behaviour is good for Sequel practices :) Thank you very much. -- David -- 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 post to this group, send email to sequel-talk@googlegroups.com. Visit this group at https://groups.google.com/group/sequel-talk. For more options, visit https://groups.google.com/d/optout.