aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib/action_view')
-rw-r--r--actionpack/lib/action_view/helpers/url_helper.rb7
-rw-r--r--actionpack/lib/action_view/template.rb6
2 files changed, 9 insertions, 4 deletions
diff --git a/actionpack/lib/action_view/helpers/url_helper.rb b/actionpack/lib/action_view/helpers/url_helper.rb
index 1415966869..5925faf810 100644
--- a/actionpack/lib/action_view/helpers/url_helper.rb
+++ b/actionpack/lib/action_view/helpers/url_helper.rb
@@ -10,6 +10,12 @@ module ActionView
# This allows you to use the same format for links in views
# and controllers.
module UrlHelper
+ # This helper may be included in any class that includes the
+ # URL helpers of a router (router.url_helpers). Some methods
+ # provided here will only work in the context of a request
+ # (link_to_unless_current, for instance), which must be provided
+ # as a method called #request on the context.
+
extend ActiveSupport::Concern
include ActionDispatch::Routing::UrlFor
@@ -307,7 +313,6 @@ module ActionView
# # </div>
# # </form>"
# #
-
def button_to(name, options = {}, html_options = {})
html_options = html_options.stringify_keys
convert_boolean_attributes!(html_options, %w( disabled ))
diff --git a/actionpack/lib/action_view/template.rb b/actionpack/lib/action_view/template.rb
index 3df2bd8eed..3c0cd35359 100644
--- a/actionpack/lib/action_view/template.rb
+++ b/actionpack/lib/action_view/template.rb
@@ -18,7 +18,7 @@ module ActionView
attr_reader :source, :identifier, :handler, :virtual_path, :formats
- def self.finalizer_for(method_name)
+ Finalizer = proc do |method_name|
proc do
ActionView::CompiledTemplates.module_eval do
remove_possible_method method_name
@@ -77,7 +77,6 @@ module ActionView
private
def compile(locals, view)
method_name = build_method_name(locals)
-
return method_name if view.respond_to?(method_name)
locals_code = locals.keys.map! { |key| "#{key} = local_assigns[:#{key}];" }.join
@@ -106,7 +105,8 @@ module ActionView
begin
ActionView::CompiledTemplates.module_eval(source, identifier, line)
- ObjectSpace.define_finalizer(self, self.class.finalizer_for(method_name))
+ ObjectSpace.define_finalizer(self, Finalizer[method_name])
+
method_name
rescue Exception => e # errors from template code
if logger = (view && view.logger)