tyler-x6HOQYo3xDg4mGHdZ9yRmg@public.gmane.org
2009-Mar-15 03:40 UTC
Factory Girl Associations Issue with Uniqueness Validations
Greetings, Does anybody have a workaround/solution for Factory Girl''s insistence on creating a new record for each association it creates? As far as I can tell, this makes using Factory Girl unusable when you have uniqueness validations on the model referenced by the FK when testing interrelated has_many/belongs_to associations. What am I missing here? Google shows many people with same issue without a clear resolution. I may just need some sleep. :-) Thanks TMA --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
mirts
2009-Mar-19 18:01 UTC
Re: Factory Girl Associations Issue with Uniqueness Validations
I have exactly the same problem... but no solution. Would also greatly appreciate suggestions as to a workaround. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Andrew Timberlake
2009-Mar-20 07:24 UTC
Re: Factory Girl Associations Issue with Uniqueness Validations
On Thu, Mar 19, 2009 at 8:01 PM, mirts <dasmirts-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > I have exactly the same problem... but no solution. Would also greatly > appreciate suggestions as to a workaround. > > > >When I encounter this type of issue, I tend to create the high level objects and then explicitly include them @author = Factory(:author) book1 = Factory(:book, :author => @author) book2 = Factory(:book, :author => @author) etc. Andrew Timberlake http://ramblingsonrails.com http://www.linkedin.com/in/andrewtimberlake "I have never let my schooling interfere with my education" - Mark Twain --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---