Skip to content

Instantly share code, notes, and snippets.

@NZKoz
Created May 29, 2011 22:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NZKoz/998209 to your computer and use it in GitHub Desktop.
Save NZKoz/998209 to your computer and use it in GitHub Desktop.
Hax to get around a factory girl issue
#EGGREGIOUS HAX
class Factory::Proxy::Build
def associate(name, factory, attributes)
if factory.to_s =~ /member/i
set(name, Factory.build(factory, attributes))
else
set(name, Factory.create(factory, attributes))
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment