Erik Escobedo
Erik Escobedo

Reputation: 2803

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 app.

Upvotes: 1

Views: 1441

Answers (2)

montrealmike
montrealmike

Reputation: 11641

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.

Upvotes: 0

Tanel Suurhans
Tanel Suurhans

Reputation: 1761

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.

Upvotes: 1

Related Questions