提交 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
SET = []
EXTENSION_LOOKUP = Hash.new { |h, k| h[k] = Type.new(k) unless k.blank? }
......
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 Helpers #:nodoc:
......
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 Helpers #:nodoc:
......
......@@ -72,7 +72,7 @@ def #{render_symbol}(local_assigns)
end_src
begin
logger = Base.logger
logger = defined? ActionController && Base.logger
logger.debug "Compiling template #{render_symbol}" if logger
ActionView::Base::CompiledTemplates.module_eval(source, filename, 0)
......
......@@ -16,7 +16,11 @@ def counter_name
memoize :counter_name
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
end
end
......
require 'action_controller/mime_type'
module ActionView #:nodoc:
class Template
extend TemplateHandlers
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册