Re: [Rails] Re: Validations not working on complex DB transaction

2013-08-06 Thread Carlos Figueiredo
Yeah, It's exactly that... you are creating a user before the Institution... But I your controller isn't searching for some Institution while creating the User... I just see your controller creating an Institution... doesn't matter if already exists... *Carlos Figueiredo* On Tue, Aug 6, 2013 a

Re: [Rails] Re: Validations not working on complex DB transaction

2013-08-06 Thread selva4...@gmail.com
Hi, The @user object is getting saved first. That time, there is no instuition membership attached to it. So one is getting created. Then when you save the instuition membership again inside the controller it also gets saved. Is this clear? On Sat, Aug 3, 2013 at 2:00 AM, masta Blasta wrote: >

[Rails] Re: Validations not working on complex DB transaction

2013-08-02 Thread masta Blasta
Matt Jones wrote in post #1117517: > On Thursday, 1 August 2013 10:56:06 UTC-4, Ruby-Forum.com User wrote: >> if institution_memberships.empty? >> >> ) >> only have one membership per institution, hence the >> well enough to pinpoint the exact cause. Obviously there is no need to >>

[Rails] Re: Validations not working on complex DB transaction

2013-08-02 Thread Matt Jones
On Thursday, 1 August 2013 10:56:06 UTC-4, Ruby-Forum.com User wrote: > > The models: > > class User > has_many :institution_memberships > belongs_to :account > > after_create :set_default_membership > > def set_default_membership > if institution_memberships.empty?