thoughtbot/factory_girl — Issue #311: Magic alias ignoring is blocking set of attribute :foo_id if :foo is an override
Author: ijcd
Created: 2012-03-09 04:04:02+00:00
State: open

I'm trying to use FactoryGirl to create ActiveResource mocks (where there aren't real associations), but AttributeAssigner#alias_names_to_ignore has some magic in it that's preventing me from doing the following:

ignore do
merchant { Factory(:merchant) }
end

merchant_name { merchant.name }
merchant_id { merchant.id }

Where the idea is:

Factory(:resource, :merchant => Factory(:merchant, ...))

The problem is that merchant_id gets silently ignored when :merchant is passed in as an override. Is there a way to override this behavior somehow? I can supply a patch if enlightened as to the purpose of this code.