From bea737eb5a5f51ee7fbc2e60d870cee5936bdfb0 Mon Sep 17 00:00:00 2001 From: Sam Stephenson Date: Tue, 22 Nov 2005 08:37:04 +0000 Subject: Make ActionController's render honor the :locals option when rendering a :file. Closes #1665. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3157 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/lib/action_controller/base.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'actionpack/lib/action_controller') diff --git a/actionpack/lib/action_controller/base.rb b/actionpack/lib/action_controller/base.rb index 225a61f43e..9aab2c5028 100755 --- a/actionpack/lib/action_controller/base.rb +++ b/actionpack/lib/action_controller/base.rb @@ -459,6 +459,10 @@ module ActionController #:nodoc: self.class.controller_name end + def session_enabled? + request.session_options[:disabled] != false + end + protected # Renders the content that will be returned to the browser as the response body. # @@ -596,7 +600,7 @@ module ActionController #:nodoc: else if file = options[:file] - render_file(file, options[:status], options[:use_full_path]) + render_file(file, options[:status], options[:use_full_path], options[:locals] || {}) elsif template = options[:template] render_file(template, options[:status], true) @@ -645,11 +649,11 @@ module ActionController #:nodoc: end end - def render_file(template_path, status = nil, use_full_path = false) + def render_file(template_path, status = nil, use_full_path = false, locals = {}) add_variables_to_assigns assert_existance_of_template_file(template_path) if use_full_path logger.info("Rendering #{template_path}" + (status ? " (#{status})" : '')) if logger - render_text(@template.render_file(template_path, use_full_path), status) + render_text(@template.render_file(template_path, use_full_path, locals), status) end def render_template(template, status = nil, type = :rhtml, local_assigns = {}) -- cgit v1.2.3