Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

RAILS_ROOT is deprecated, use Rails.root

  • Loading branch information...
commit 66763795d0ee4d73906ecff4fd69ec0e8aaf2e0c 1 parent 1ca59de
Yaroslav Markin authored dhh committed
2  README
@@ -42,7 +42,7 @@ Upon visiting http://your_app.com/tolk - you will be presented with different op
42 42
 
43 43
   $ rake tolk:dump_all
44 44
 
45  
-This will generate yml files for all non primary locales and put them in RAILS_ROOT/config/locales/ directory by default.
  45
+This will generate yml files for all non primary locales and put them in #{Rails.root}/config/locales/ directory by default.
46 46
 
47 47
 You can use the dump_all method defined in Tolk::Locale directly and pass directory path as the argument if you want the generated files to be at a different location :
48 48
 
2  test/integration/translation_process_test.rb
@@ -47,7 +47,7 @@ def setup_locales
47 47
     Tolk::Translation.delete_all
48 48
     Tolk::Phrase.delete_all
49 49
 
50  
-    Tolk::Locale.locales_config_path = RAILS_ROOT + "/test/locales/sync"
  50
+    Tolk::Locale.locales_config_path = File.join(Rails.root, "test/locales/sync")
51 51
     Tolk::Locale.primary_locale(true)
52 52
 
53 53
     Tolk::Locale.sync!
12  test/unit/locale_test.rb
@@ -48,19 +48,19 @@ class LocaleTest < ActiveSupport::TestCase
48 48
     Tolk::Locale.primary_locale_name = 'en'
49 49
 
50 50
     begin
51  
-      FileUtils.mkdir_p(RAILS_ROOT + "/tmp/locales")
52  
-      Tolk::Locale.dump_all(RAILS_ROOT + "/tmp/locales")
  51
+      FileUtils.mkdir_p(File.join(Rails.root, "tmp/locales"))
  52
+      Tolk::Locale.dump_all(File.join(Rails.root, "tmp/locales"))
53 53
 
54 54
       %w( da se ).each do |locale|
55 55
         assert_equal \
56  
-          File.read(RAILS_ROOT + "/test/locales/basic/#{locale}.yml"), 
57  
-          File.read(RAILS_ROOT + "/tmp/locales/#{locale}.yml")
  56
+          File.read(File.join(Rails.root, "test/locales/basic/#{locale}.yml")),
  57
+          File.read(File.join(Rails.root, "tmp/locales/#{locale}.yml"))
58 58
       end
59 59
 
60 60
       # Make sure dump doesn't generate en.yml
61  
-      assert ! File.exists?(RAILS_ROOT + "/tmp/locales/en.yml")
  61
+      assert ! File.exists?(File.join(Rails.root, "tmp/locales/en.yml"))
62 62
     ensure
63  
-      FileUtils.rm_rf(RAILS_ROOT + "/tmp/locales")
  63
+      FileUtils.rm_rf(File.join(Rails.root, "tmp/locales"))
64 64
     end
65 65
   end
66 66
 
4  test/unit/sync_test.rb
@@ -7,7 +7,7 @@ def setup
7 7
     Tolk::Translation.delete_all
8 8
     Tolk::Phrase.delete_all
9 9
 
10  
-    Tolk::Locale.locales_config_path = RAILS_ROOT + "/test/locales/sync/"
  10
+    Tolk::Locale.locales_config_path = File.join(Rails.root, "test/locales/sync/")
11 11
 
12 12
     I18n.backend.reload!
13 13
     I18n.load_path = [Tolk::Locale.locales_config_path + 'en.yml']
@@ -159,7 +159,7 @@ def test_dump_all_after_sync
159 159
     phrase = Tolk::Phrase.all.detect {|p| p.key == 'hello_world'}
160 160
     hola = spanish.translations.create!(:text => 'hola', :phrase => phrase)
161 161
 
162  
-    tmpdir = RAILS_ROOT + "/tmp/sync/locales"
  162
+    tmpdir = File.join Rails.root, "tmp/sync/locales"
163 163
     FileUtils.mkdir_p(tmpdir)
164 164
     Tolk::Locale.dump_all(tmpdir)
165 165
 

0 notes on commit 6676379

Please sign in to comment.
Something went wrong with that request. Please try again.