Hello all! I have a conundrum that I''m _sure_ someone else has already thought of and solved. How does one best handle the scenario of association object changes and data integrity? For example, if I have a standard ecommerce site that sells Products and people can have Orders and an Order has_many Products... then, what happens if Product #3 is part of Order #2 but at some point, the shop owner goes in and edits Product #3 to change it''s description... or it''s price... or marks it as "no longer for sale"? Now, Order #2 is referencing Product #3 via the association but the data in Product #3 is no longer the right data for the Order? I can imagine a number of ways to handle this, but none of them seem ideal. I''m curious what people do in this type of (very?) common scenario. Thanks! -Danimal --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
cherrian harada
2008-Sep-18 03:15 UTC
Re: handling association changes? What''s the best practice?
Select_Description_Products_Orders_1>3 On Thu, Sep 18, 2008 at 12:05 PM, Danimal <fightonfightwell-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote:> > Hello all! > > I have a conundrum that I''m _sure_ someone else has already thought of > and solved. How does one best handle the scenario of association > object changes and data integrity? > > For example, if I have a standard ecommerce site that sells Products > and people can have Orders and an Order has_many Products... then, > what happens if Product #3 is part of Order #2 but at some point, the > shop owner goes in and edits Product #3 to change it''s description... > or it''s price... or marks it as "no longer for sale"? Now, Order #2 is > referencing Product #3 via the association but the data in Product #3 > is no longer the right data for the Order? > > I can imagine a number of ways to handle this, but none of them seem > ideal. I''m curious what people do in this type of (very?) common > scenario. > > Thanks! > > -Danimal > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Philip Hallstrom
2008-Sep-18 03:22 UTC
Re: handling association changes? What''s the best practice?
> I have a conundrum that I''m _sure_ someone else has already thought of > and solved. How does one best handle the scenario of association > object changes and data integrity? > > For example, if I have a standard ecommerce site that sells Products > and people can have Orders and an Order has_many Products... then, > what happens if Product #3 is part of Order #2 but at some point, the > shop owner goes in and edits Product #3 to change it''s description... > or it''s price... or marks it as "no longer for sale"? Now, Order #2 is > referencing Product #3 via the association but the data in Product #3 > is no longer the right data for the Order? > > I can imagine a number of ways to handle this, but none of them seem > ideal. I''m curious what people do in this type of (very?) common > scenario.Once a product is put into an order it becomes a "line item". The line item has the sku, quantity and price at the time it was added. I''d also put in a description which would be the product name and you may as well associate it with the product, but don''t ever look at the product''s price -- just the line items price. In the case where you want to delete a product, simply flag it as unavailable/old/expired/hidden or something instead. That way you can still go see the original product from a given order if you wanted to. -philip --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
cherrian harada
2008-Sep-18 03:29 UTC
Re: handling association changes? What''s the best practice?
What''s sku? On Thu, Sep 18, 2008 at 12:22 PM, Philip Hallstrom <philip-LSG90OXdqQE@public.gmane.org> wrote:> > > I have a conundrum that I''m _sure_ someone else has already thought of > > and solved. How does one best handle the scenario of association > > object changes and data integrity? > > > > For example, if I have a standard ecommerce site that sells Products > > and people can have Orders and an Order has_many Products... then, > > what happens if Product #3 is part of Order #2 but at some point, the > > shop owner goes in and edits Product #3 to change it''s description... > > or it''s price... or marks it as "no longer for sale"? Now, Order #2 is > > referencing Product #3 via the association but the data in Product #3 > > is no longer the right data for the Order? > > > > I can imagine a number of ways to handle this, but none of them seem > > ideal. I''m curious what people do in this type of (very?) common > > scenario. > > Once a product is put into an order it becomes a "line item". The > line item has the sku, quantity and price at the time it was added. > I''d also put in a description which would be the product name and you > may as well associate it with the product, but don''t ever look at the > product''s price -- just the line items price. > > In the case where you want to delete a product, simply flag it as > unavailable/old/expired/hidden or something instead. That way you can > still go see the original product from a given order if you wanted to. > > -philip > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Danimal
2008-Sep-18 03:34 UTC
Re: handling association changes? What''s the best practice?
Philip, Thanks for the post. This was kind of what I was thinking... but I am still unsure about it (or some of it). For example, what if the product has a detailed description that includes something like "includes 2 free wuzzits". And so I order that product. But later, the store owner changes the description to say "includes 3 free wuzzits". It''s still the same product, but the description is different. So would you include the description on the line item? And what about the case where it''s not a product that''s offered but more like a service. I guess you could still consider a line item for the service, but it''s fuzzier, at least to me. I''ve thought of: having "locked" products (or services) that can''t be changed... just disabled. I''ve thought of including all the necessary fields on the "line item" record I''ve thought of using versioning (a couple plugins out there) I''ve thought of doing nothing but having the application make it clear to the store owner that if they materially change information about a product or service, it will be reflected in previous orders. None of these seem perfect... they each have their pluses and minuses. Any more thoughts/advice? Thanks, -Danimal On Sep 17, 9:22 pm, Philip Hallstrom <phi...-LSG90OXdqQE@public.gmane.org> wrote:> > I have a conundrum that I''m _sure_ someone else has already thought of > > and solved. How does one best handle the scenario of association > > object changes and data integrity? > > > For example, if I have a standard ecommerce site that sells Products > > and people can have Orders and an Order has_many Products... then, > > what happens if Product #3 is part of Order #2 but at some point, the > > shop owner goes in and edits Product #3 to change it''s description... > > or it''s price... or marks it as "no longer for sale"? Now, Order #2 is > > referencing Product #3 via the association but the data in Product #3 > > is no longer the right data for the Order? > > > I can imagine a number of ways to handle this, but none of them seem > > ideal. I''m curious what people do in this type of (very?) common > > scenario. > > Once a product is put into an order it becomes a "line item". The > line item has the sku, quantity and price at the time it was added. > I''d also put in a description which would be the product name and you > may as well associate it with the product, but don''t ever look at the > product''s price -- just the line items price. > > In the case where you want to delete a product, simply flag it as > unavailable/old/expired/hidden or something instead. That way you can > still go see the original product from a given order if you wanted to. > > -philip--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Erol Fornoles
2008-Sep-18 08:16 UTC
Re: handling association changes? What''s the best practice?
On Sep 18, 11:29 am, "cherrian harada" <cchi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> What''s sku?Stock-Keeping Unit http://en.wikipedia.org/wiki/Stock_Keeping_Unit --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
cherrian harada
2008-Sep-19 06:03 UTC
Re: handling association changes? What''s the best practice?
Hi! Does this group have a Q/A page? It seems I get alot people sending questions to my address with some inquiries, I really don''t mind it. It actually, feels good and I sort like it... only problem is I don''t have the answers to give these questions for each person. If I have some reference I probably could help...Wish I did because I would consider myself a big help to this RoR community. Unfortunately, I not at that level, to independently reply to these queries yet.... Wish I could be a bigger help to you guys, I also have my questions on RoR too... Cherri On Thu, Sep 18, 2008 at 5:16 PM, Erol Fornoles <erol.fornoles-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote:> > On Sep 18, 11:29 am, "cherrian harada" <cchi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > What''s sku? > > Stock-Keeping Unit > > http://en.wikipedia.org/wiki/Stock_Keeping_Unit > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Erol Fornoles
2008-Sep-19 06:41 UTC
Re: handling association changes? What''s the best practice?
On Sep 19, 2:03 pm, "cherrian harada" <cchi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi! Does this group have a Q/A page? > It seems I get alot people sending questions to my address with some > inquiries, I really don''t mind it. It actually, feels good and I sort like > it... only problem is I don''t have the answers to give these questions for > each person. If I have some reference I probably could help...Wish I did > because I would consider myself a big help to this RoR community. > Unfortunately, I not at that level, to independently reply to these > queries yet.... > Wish I could be a bigger help to you guys, I also have my questions on RoR > too... > CherriBecause you''re a member of the group, you''ll receive every message sent to the group. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
cherrian harada
2008-Sep-19 08:22 UTC
Re: handling association changes? What''s the best practice?
O>K! I see...+;) On Fri, Sep 19, 2008 at 3:41 PM, Erol Fornoles <erol.fornoles-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote:> > On Sep 19, 2:03 pm, "cherrian harada" <cchi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Hi! Does this group have a Q/A page? > > It seems I get alot people sending questions to my address with some > > inquiries, I really don''t mind it. It actually, feels good and I sort > like > > it... only problem is I don''t have the answers to give these questions > for > > each person. If I have some reference I probably could help...Wish I did > > because I would consider myself a big help to this RoR community. > > Unfortunately, I not at that level, to independently reply to these > > queries yet.... > > Wish I could be a bigger help to you guys, I also have my questions on > RoR > > too... > > Cherri > > Because you''re a member of the group, you''ll receive every message > sent to the group. > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---