aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--railties/CHANGELOG2
-rw-r--r--railties/lib/initializer.rb4
-rw-r--r--railties/test/initializer_test.rb4
3 files changed, 5 insertions, 5 deletions
diff --git a/railties/CHANGELOG b/railties/CHANGELOG
index ad8ba43c17..6d822a2f88 100644
--- a/railties/CHANGELOG
+++ b/railties/CHANGELOG
@@ -1,6 +1,6 @@
*2.3.0 [Edge]*
-* Enhanced Rails.root to take parameters that'll be join with the root, like Rails.root('app', 'controllers') => File.join(Rails.root, 'app', 'controllers') #1482 [Damian Janowski]
+* Changed Rails.root to return a Pathname object (allows for Rails.root.join('app', 'controllers') => "#{RAILS_ROOT}/app/controllers") #1482 [Damian Janowski/?]
* Added view path support for engines [DHH]
diff --git a/railties/lib/initializer.rb b/railties/lib/initializer.rb
index ef0c335478..a134c68a50 100644
--- a/railties/lib/initializer.rb
+++ b/railties/lib/initializer.rb
@@ -48,8 +48,8 @@ module Rails
end
end
- def root(*args)
- File.join(RAILS_ROOT, *args.compact) if defined?(RAILS_ROOT)
+ def root
+ Pathname.new(RAILS_ROOT) if defined?(RAILS_ROOT)
end
def env
diff --git a/railties/test/initializer_test.rb b/railties/test/initializer_test.rb
index 33c81bc5ad..99f69a1575 100644
--- a/railties/test/initializer_test.rb
+++ b/railties/test/initializer_test.rb
@@ -317,7 +317,7 @@ class RailsRootTest < Test::Unit::TestCase
assert_equal RAILS_ROOT, Rails.root
end
- def test_rails_dot_root_accepts_arguments_for_file_dot_join
- assert_equal File.join(RAILS_ROOT, 'app', 'controllers'), Rails.root('app', 'controllers')
+ def test_rails_dot_root_should_be_a_pathname
+ assert_equal File.join(RAILS_ROOT, 'app', 'controllers'), Rails.root.join('app', 'controllers')
end
end \ No newline at end of file