Skip to content

Commit 9ca7159

Browse files
committed
Merge pull request resque#702 from marten/update-readme-wrt-rails-root-env
update readme for Rails.root/Rails.env
2 parents 4de741f + 7043cae commit 9ca7159

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -854,14 +854,14 @@ So that you can flush it and without impacting development environment
854854
And our initializer:
855855
856856
``` ruby
857-
rails_root = ENV['RAILS_ROOT'] || File.dirname(__FILE__) + '/../..'
858-
rails_env = ENV['RAILS_ENV'] || 'development'
857+
rails_root = Rails.root || File.dirname(__FILE__) + '/../..'
858+
rails_env = Rails.env || 'development'
859859

860860
resque_config = YAML.load_file(rails_root + '/config/resque.yml')
861861
Resque.redis = resque_config[rails_env]
862862
```
863863

864-
Easy peasy! Why not just use `RAILS_ROOT` and `RAILS_ENV`? Because
864+
Easy peasy! Why not just use `Rails.root` and `Rails.env`? Because
865865
this way we can tell our Sinatra app about the config file:
866866

867867
$ RAILS_ENV=production resque-web rails_root/config/initializers/resque.rb
@@ -872,7 +872,7 @@ Also, you could disable jobs queueing by setting 'inline' attribute.
872872
For example, if you want to run all jobs in the same process for cucumber, try:
873873

874874
``` ruby
875-
Resque.inline = ENV['RAILS_ENV'] == "cucumber"
875+
Resque.inline = Rails.env.cucumber?
876876
```
877877

878878

0 commit comments

Comments
 (0)