提交 9853134b 编写于 作者: J Joshua Peek

Require missing libraries and check for defined ActionController constant so...

Require missing libraries and check for defined ActionController constant so ActionView can be used standalone
上级 8756dd75
require 'set'
module Mime module Mime
SET = [] SET = []
EXTENSION_LOOKUP = Hash.new { |h, k| h[k] = Type.new(k) unless k.blank? } EXTENSION_LOOKUP = Hash.new { |h, k| h[k] = Type.new(k) unless k.blank? }
......
require 'action_view/helpers/tag_helper' require 'action_view/helpers/tag_helper'
require 'html/document'
begin
require 'html/document'
rescue LoadError
html_scanner_path = "#{File.dirname(__FILE__)}/../../action_controller/vendor/html-scanner"
if File.directory?(html_scanner_path)
$:.unshift html_scanner_path
require 'html/document'
end
end
module ActionView module ActionView
module Helpers #:nodoc: module Helpers #:nodoc:
......
require 'action_view/helpers/tag_helper' require 'action_view/helpers/tag_helper'
require 'html/document'
begin
require 'html/document'
rescue LoadError
html_scanner_path = "#{File.dirname(__FILE__)}/../../action_controller/vendor/html-scanner"
if File.directory?(html_scanner_path)
$:.unshift html_scanner_path
require 'html/document'
end
end
module ActionView module ActionView
module Helpers #:nodoc: module Helpers #:nodoc:
......
...@@ -72,7 +72,7 @@ def #{render_symbol}(local_assigns) ...@@ -72,7 +72,7 @@ def #{render_symbol}(local_assigns)
end_src end_src
begin begin
logger = Base.logger logger = defined? ActionController && Base.logger
logger.debug "Compiling template #{render_symbol}" if logger logger.debug "Compiling template #{render_symbol}" if logger
ActionView::Base::CompiledTemplates.module_eval(source, filename, 0) ActionView::Base::CompiledTemplates.module_eval(source, filename, 0)
......
...@@ -16,7 +16,11 @@ def counter_name ...@@ -16,7 +16,11 @@ def counter_name
memoize :counter_name memoize :counter_name
def render(view, local_assigns = {}) def render(view, local_assigns = {})
ActionController::Base.benchmark("Rendered #{path_without_format_and_extension}", Logger::DEBUG, false) do if defined? ActionController
ActionController::Base.benchmark("Rendered #{path_without_format_and_extension}", Logger::DEBUG, false) do
super
end
else
super super
end end
end end
......
require 'action_controller/mime_type'
module ActionView #:nodoc: module ActionView #:nodoc:
class Template class Template
extend TemplateHandlers extend TemplateHandlers
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册