diff --git a/railties/lib/rails/engine.rb b/railties/lib/rails/engine.rb
index <HASH>..<HASH> 100644
--- a/railties/lib/rails/engine.rb
+++ b/railties/lib/rails/engine.rb
@@ -652,7 +652,7 @@ module Rails
       root = File.exist?("#{root_path}/#{flag}") ? root_path : default
       raise "Could not find root path for #{self}" unless root
 
-      File.realpath root
+      Pathname.new File.realpath root
     end
 
     def default_middleware_stack
I guess we have to return a pathname object. o_O