Is it posible to dump a MySQL Database into a seed.rb file?
I have a rails app with a heavy initial data in the database. Everytime I use rake db:reset
I must import a sql file for loading this data. That is not kinda rails way, so I whis I could get this data into a seed.rb and deploy it with the开发者_如何学Go app.
I would recommend making a simple rake task that loads the dump into your current environments database. If you want to load the dump in your seed.rb why not just write the code for importing the sql formatted dump. Its easier than converting the dump into executable ruby code or something similar.
Another option is the has_alter_ego gem
Although it seems to have some bugs and no one is taking the lead on fixing them.
精彩评论