Friday, 27 July 2012

ruby RAILS_ENV=test on rake db:migrate

CREDITS TO:

https://github.com/pauldix/service-oriented-design-with-ruby/issues/1

Hi Paul,
I'm reading and working through you book page by page, bumping into issues mostly related to the fact that I'm am trying to learn Ruby and SOD at the same time. I have run into this issue on page 19 of the book where it says that to migrate the test database, one needs to run the command:
    rake db:migrate RAILS_ENV=test
Upon repeatedly running this command and searching why it didn't run (to no avail), I turned to the rakefile and there I found that the env variable is set to either SINATRA_ENV or development (line 11?):
   env = ENV["SINATRA_ENV"] || "development"
Then when running the rake command again as below, my migration ran fine:
    rake db:migrate SINATRA_ENV=test
As I said, I am learning as I go, so this may not be the optimal solution.
I would love to hear if I went up the right track on this one.
Rgdz,
Oscar

0 comments:

Post a Comment