Dependent attributes broken in 1.3.3 #297

Closed
benfyvie opened this Issue Feb 16, 2012 · 2 comments

Comments

Projects
None yet
2 participants
@benfyvie

The change in version 1.3.3 seems to have broken dependent attributes. Take the following:

Factory.define :post do |p|
  p.author {|factory| factory.association(:user, :last_name => 'Writely') }
  p.signature {lfactory| factory.association(:signature, :user => factory.author, :visible => true}
end

The problem here is that factory.author is returning nil.

The bug was introduced here:
3923d20

One solution (though not ideal) would be to have the ability to access factory.new_attributes.author

@joshuaclayton

This comment has been minimized.

Show comment
Hide comment
@joshuaclayton

joshuaclayton Feb 17, 2012

Member

@benfyvie did you recently come across this issue? We haven't changed 1.3.3 in a very long time; 2.0 was released last summer and I'm about to release 2.6 today. Upgrading resolves this issue (we spent a significant amount of time fixing evaluation order so issues like this have been resolved) and the syntax can remain the same (although you'll get deprecation warnings until you upgrade to the new syntax).

Member

joshuaclayton commented Feb 17, 2012

@benfyvie did you recently come across this issue? We haven't changed 1.3.3 in a very long time; 2.0 was released last summer and I'm about to release 2.6 today. Upgrading resolves this issue (we spent a significant amount of time fixing evaluation order so issues like this have been resolved) and the syntax can remain the same (although you'll get deprecation warnings until you upgrade to the new syntax).

@benfyvie

This comment has been minimized.

Show comment
Hide comment
@benfyvie

benfyvie Feb 28, 2012

I ran into this issue after upgrading to 1.3.3 due to issues with the callback inheritance order issue in 1.3.2

For some reason I had it in my head that factory_girl 2.x was not compatible with Rails 2.x, but now I see that I was thinking of rspec. I will attempt to upgrade our project to use factory_girl 2.x to work around these issues.

I ran into this issue after upgrading to 1.3.3 due to issues with the callback inheritance order issue in 1.3.2

For some reason I had it in my head that factory_girl 2.x was not compatible with Rails 2.x, but now I see that I was thinking of rspec. I will attempt to upgrade our project to use factory_girl 2.x to work around these issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment