提交 7f7dfd2b 编写于 作者: J José Valim

Take into account gem versions (so script/rails server can work outside the...

Take into account gem versions (so script/rails server can work outside the application) and use Rails::Application.root instead of ROOT_PATH.
上级 17b45189
......@@ -3,7 +3,6 @@
ENV_PATH = File.expand_path('../../config/environment', __FILE__)
BOOT_PATH = File.expand_path('../../config/boot', __FILE__)
APP_PATH = File.expand_path('../../config/application', __FILE__)
ROOT_PATH = File.expand_path('../..', __FILE__)
require BOOT_PATH
require 'rails/commands'
......@@ -35,7 +35,7 @@
when 's', 'server'
require APP_PATH
require 'rails/commands/server'
Dir.chdir(ROOT_PATH)
Dir.chdir(Rails::Application.root)
Rails::Server.start
when 'db', 'dbconsole'
require 'rails/commands/dbconsole'
......
......@@ -16,7 +16,7 @@ def inherited(base)
unless abstract_railtie?(base)
base.called_from = begin
call_stack = caller.map { |p| p.split(':').first }
File.dirname(call_stack.detect { |p| p !~ %r[railties/lib/rails|rack/lib/rack] })
File.dirname(call_stack.detect { |p| p !~ %r[railties[\w\-]*/lib/rails|rack[\w\-]*/lib/rack] })
end
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册