Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Changed Rails.root to return a Pathname object (allows for Rails.root…

….join("app", "controllers") => "#{RAILS_ROOT}/app/controllers") [#1482]
  • Loading branch information...
commit be140e8c6be966349c6fa35a87f84d5a73995b9a 1 parent 668872e
@dhh dhh authored
View
2  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]
View
4 railties/lib/initializer.rb
@@ -48,8 +48,8 @@ def backtrace_cleaner
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
View
4 railties/test/initializer_test.rb
@@ -317,7 +317,7 @@ def test_rails_dot_root_equals_rails_root
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

1 comment on commit be140e8

@anildigital

Simple change with more profit.

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