diff options
Diffstat (limited to 'actionpack/lib/action_view/base.rb')
-rw-r--r-- | actionpack/lib/action_view/base.rb | 36 |
1 files changed, 25 insertions, 11 deletions
diff --git a/actionpack/lib/action_view/base.rb b/actionpack/lib/action_view/base.rb index 31e9c5ef9d..c33695770f 100644 --- a/actionpack/lib/action_view/base.rb +++ b/actionpack/lib/action_view/base.rb @@ -169,6 +169,15 @@ module ActionView #:nodoc: include Helpers, Rendering, Partials, ::ERB::Util + def config + self.config = DEFAULT_CONFIG unless @config + @config + end + + def config=(config) + @config = ActiveSupport::OrderedOptions.new.merge(config) + end + extend ActiveSupport::Memoizable attr_accessor :base_path, :assigns, :template_extension, :formats @@ -178,11 +187,11 @@ module ActionView #:nodoc: def reset_formats(formats) @formats = formats - if defined?(ActionController) + if defined?(AbstractController::HashKey) # This is expensive, but we need to reset this when the format is updated, # which currently only happens Thread.current[:format_locale_key] = - ActionController::HashKey.get(self.class, formats, I18n.locale) + AbstractController::HashKey.get(self.class, formats, I18n.locale) end end @@ -203,6 +212,11 @@ module ActionView #:nodoc: @@cache_template_loading = nil cattr_accessor :cache_template_loading + # :nodoc: + def self.xss_safe? + true + end + def self.cache_template_loading? ActionController::Base.allow_concurrency || (cache_template_loading.nil? ? !ActiveSupport::Dependencies.load? : cache_template_loading) end @@ -236,16 +250,16 @@ module ActionView #:nodoc: # they are in AC. if controller.class.respond_to?(:_helper_serial) klass = @views[controller.class._helper_serial] ||= Class.new(self) do - const_set(:CONTROLLER_CLASS, controller.class) - # Try to make stack traces clearer - def self.name - "ActionView for #{CONTROLLER_CLASS}" - end - - def inspect - "#<#{self.class.name}>" - end + class_eval <<-ruby_eval, __FILE__, __LINE__ + 1 + def self.name + "ActionView for #{controller.class}" + end + + def inspect + "#<#{self.class.name}>" + end + ruby_eval if controller.respond_to?(:_helpers) include controller._helpers |