Topic: Rake and Rails.env in rails 3.0.6

Hey Guys,

An easy question.... How do I set Rails.env so that when I invoke

> rake db:schema:load

The db schema in my test database gets loaded?

Last edited by sonnychee (2011-04-18 02:21:18)

Re: Rake and Rails.env in rails 3.0.6

You want to make sure your test db is properly migrated up (that is, up to date with the dev database), right?

To do that you run

rake db:test:clone

Chris

Re: Rake and Rails.env in rails 3.0.6

Thanks Chris, that works.  Would you also have any insight into...

> How do I set Rails.env ?

Re: Rake and Rails.env in rails 3.0.6

Well, typically you wouldn't want to specify that in the code anywhere (except when testing -- then it gets set in a spec helper, at least if you are using RSpec; not sure with TestUnit). If you need (for example) to run your application in production mode, you can do so by doing

rails server -e production

If you really want to know how to set Rails.env in code, you can look at how a spec_helper does that.

Chris