Skip to content

Instantly share code, notes, and snippets.

View hiasinho's full-sized avatar

Mathias Maisberger hiasinho

View GitHub Profile
module FactoryGirlHelper
def find_or_create(*args)
name = args.shift
clazz = nil
# convert from underscores String to camelcase Class
if name.is_a? Hash
name = name.first[0]
clazz = name.first[1].to_s.camelize.constantize