Re: Multiple inserts in ActiveRecord

2010-08-01 Thread jeremy Ruten
I had this problem in Rails! Yes, the short circuit evaluation messes it up. So I did this: if [...@company.valid?, @user.valid?].all? # do stuff end jeremy On Sat, Jul 31, 2010 at 9:43 PM, David Susco dsu...@gmail.com wrote: That's weird, I can't test anything until Monday but

Multiple inserts in ActiveRecord

2010-07-31 Thread Magnus Holm
Hey campers, I'm wondering if any of you know a better solution to skylerrichter's problem: http://github.com/camping/camping/issues#issue/28 The basic idea is that he want to create a Company, and then the first User in that Company: @company = Company.create( :name = @input.name,

Re: Multiple inserts in ActiveRecord

2010-07-31 Thread Skyler Richter
@David Susco I figured that was the way to do it. Thats what I tried the first time but I seem to only be able to validate 1 item at a time. It only validates the company model and it ignores the @user.valid? If I rearrange my code so that the user gets saved first then only the user validates