i have data in ar table inserted manually through application, i'd export bunch of model.create!(...)
statements (in other words, want file of method calls recreate database as-is), there way automatically (through console, rake, etc.)?
you may able simple hack this:
user.all.each |user| puts "user.create!(yaml.load(<<end))\n#{user.attributes.to_yaml}\nend" end
you can generate rails runner
:
rails runner user_export.rb >> db/seeds.rb
Comments
Post a Comment