Skip to content

Instantly share code, notes, and snippets.

@alexrothenberg
Created June 18, 2009 20:12
Show Gist options
  • Save alexrothenberg/132164 to your computer and use it in GitHub Desktop.
Save alexrothenberg/132164 to your computer and use it in GitHub Desktop.
def to_factory model
model.columns.each do |c|
if c.null == false
value = case c.type
when :integer
"7"
when :string
"'hi'"
when :boolean
'false'
when :date
'{Time.now}'
when :datetime
'{Time.now}'
else
raise "forgot about #{c.type}"
end
puts "#{c.name.first}.#{c.name} #{value}"
end
end
true
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment