aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib')
-rwxr-xr-xactionpack/lib/action_controller/base.rb2
-rw-r--r--actionpack/lib/action_view.rb1
-rw-r--r--actionpack/lib/action_view/base.rb2
-rw-r--r--actionpack/lib/action_view/inline_template.rb20
-rw-r--r--actionpack/lib/action_view/template.rb22
5 files changed, 32 insertions, 15 deletions
diff --git a/actionpack/lib/action_controller/base.rb b/actionpack/lib/action_controller/base.rb
index 63ad4d042a..f620c442fd 100755
--- a/actionpack/lib/action_controller/base.rb
+++ b/actionpack/lib/action_controller/base.rb
@@ -870,7 +870,7 @@ module ActionController #:nodoc:
elsif inline = options[:inline]
add_variables_to_assigns
- tmpl = ActionView::Template.new(@template, options[:inline], false, options[:locals], true, options[:type])
+ tmpl = ActionView::InlineTemplate.new(@template, options[:inline], options[:locals], options[:type])
render_for_text(@template.render_template(tmpl), options[:status])
elsif action_name = options[:action]
diff --git a/actionpack/lib/action_view.rb b/actionpack/lib/action_view.rb
index e20812d308..f9de5c1307 100644
--- a/actionpack/lib/action_view.rb
+++ b/actionpack/lib/action_view.rb
@@ -30,6 +30,7 @@ require 'action_view/template_handlers/rjs'
require 'action_view/template_finder'
require 'action_view/template'
require 'action_view/partial_template'
+require 'action_view/inline_template'
require 'action_view/base'
require 'action_view/partials'
diff --git a/actionpack/lib/action_view/base.rb b/actionpack/lib/action_view/base.rb
index e83c8b6bd3..f001b81eca 100644
--- a/actionpack/lib/action_view/base.rb
+++ b/actionpack/lib/action_view/base.rb
@@ -279,7 +279,7 @@ If you are rendering a subtemplate, you must now use controller-like partial syn
elsif options[:partial]
render_partial(options[:partial], ActionView::Base::ObjectWrapper.new(options[:object]), options[:locals])
elsif options[:inline]
- template = Template.new(self, options[:inline], false, options[:locals], true, options[:type])
+ template = InlineTemplate.new(self, options[:inline], options[:locals], options[:type])
render_template(template)
end
end
diff --git a/actionpack/lib/action_view/inline_template.rb b/actionpack/lib/action_view/inline_template.rb
new file mode 100644
index 0000000000..87c012d181
--- /dev/null
+++ b/actionpack/lib/action_view/inline_template.rb
@@ -0,0 +1,20 @@
+module ActionView #:nodoc:
+ class InlineTemplate < Template #:nodoc:
+
+ def initialize(view, source, locals = {}, type = nil)
+ @view = view
+ @finder = @view.finder
+
+ @source = source
+ @extension = type
+ @locals = locals || {}
+
+ @handler = self.class.handler_class_for_extension(@extension).new(@view)
+ end
+
+ def method_key
+ @source
+ end
+
+ end
+end
diff --git a/actionpack/lib/action_view/template.rb b/actionpack/lib/action_view/template.rb
index 0cd6784fd8..985aa090e5 100644
--- a/actionpack/lib/action_view/template.rb
+++ b/actionpack/lib/action_view/template.rb
@@ -2,22 +2,18 @@ module ActionView #:nodoc:
class Template #:nodoc:
attr_accessor :locals
- attr_reader :handler, :path, :source, :extension, :filename, :path_without_extension, :method
+ attr_reader :handler, :path, :extension, :filename, :path_without_extension, :method
- def initialize(view, path_or_source, use_full_path, locals = {}, inline = false, inline_type = nil)
+ def initialize(view, path, use_full_path, locals = {})
@view = view
@finder = @view.finder
- unless inline
- # Clear the forward slash at the beginning if exists
- @path = use_full_path ? path_or_source.sub(/^\//, '') : path_or_source
- @view.first_render ||= @path
- @source = nil # Don't read the source until we know that it is required
- set_extension_and_file_name(use_full_path)
- else
- @source = path_or_source
- @extension = inline_type
- end
+ # Clear the forward slash at the beginning if exists
+ @path = use_full_path ? path.sub(/^\//, '') : path
+ @view.first_render ||= @path
+ @source = nil # Don't read the source until we know that it is required
+ set_extension_and_file_name(use_full_path)
+
@locals = locals || {}
@handler = self.class.handler_class_for_extension(@extension).new(@view)
end
@@ -32,7 +28,7 @@ module ActionView #:nodoc:
end
def method_key
- @method_key ||= (@filename || @source)
+ @filename
end
def base_path_for_exception