diff options
5 files changed, 17 insertions, 15 deletions
diff --git a/actionpack/lib/action_view/lookup_context.rb b/actionpack/lib/action_view/lookup_context.rb index 90c4a2759a..948f8ec42b 100644 --- a/actionpack/lib/action_view/lookup_context.rb +++ b/actionpack/lib/action_view/lookup_context.rb @@ -178,9 +178,9 @@ module ActionView initialize_details(details) end - # Freeze the current formats in the lookup context. By freezing them, you - # that next template lookups are not going to modify the formats. The con - # use this, to ensure that formats won't be further modified (as it does + # Freeze the current formats in the lookup context. By freezing them, you are guaranteeing + # that next template lookups are not going to modify the formats. The controller can also + # use this, to ensure that formats won't be further modified (as it does in respond_to blocks). def freeze_formats(formats, unless_frozen=false) #:nodoc: return if unless_frozen && @frozen_formats self.formats = formats diff --git a/actionpack/lib/action_view/template.rb b/actionpack/lib/action_view/template.rb index 630625fb90..f64cecaf20 100644 --- a/actionpack/lib/action_view/template.rb +++ b/actionpack/lib/action_view/template.rb @@ -159,16 +159,18 @@ module ActionView # virtual path set (true just for inline templates). def refresh(view) raise "A template needs to have a virtual path in order to be refreshed" unless @virtual_path - lookup = view.lookup_context - pieces = @virtual_path.split("/") - name = pieces.pop - partial = !!name.sub!(/^_/, "") - previous_formats, lookup.formats = lookup.formats, @formats - lookup.disable_cache do - lookup.find_template(name, [ pieces.join('/') ], partial, @locals) + begin + lookup = view.lookup_context + pieces = @virtual_path.split("/") + name = pieces.pop + partial = !!name.sub!(/^_/, "") + previous_formats, lookup.formats = lookup.formats, @formats + lookup.disable_cache do + lookup.find_template(name, [ pieces.join('/') ], partial, @locals) + end + ensure + lookup.formats = previous_formats end - ensure - lookup.formats = previous_formats end def inspect diff --git a/actionpack/test/template/template_test.rb b/actionpack/test/template/template_test.rb index 63f1d3a6c0..8c57ada587 100644 --- a/actionpack/test/template/template_test.rb +++ b/actionpack/test/template/template_test.rb @@ -12,7 +12,7 @@ class TestERBTemplate < ActiveSupport::TestCase def find_template(*args) end - attr_writer :formats + attr_accessor :formats end class Context diff --git a/activemodel/lib/active_model/attribute_methods.rb b/activemodel/lib/active_model/attribute_methods.rb index 52f270ff33..97a83e58af 100644 --- a/activemodel/lib/active_model/attribute_methods.rb +++ b/activemodel/lib/active_model/attribute_methods.rb @@ -223,7 +223,7 @@ module ActiveModel unless instance_method_already_implemented?(method_name) generate_method = "define_method_#{matcher.method_missing_target}" - if respond_to?(generate_method) + if respond_to?(generate_method, true) send(generate_method, attr_name) else define_optimized_call generated_attribute_methods, method_name, matcher.method_missing_target, attr_name.to_s diff --git a/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb index e1dad5b166..88b356caee 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb @@ -427,7 +427,7 @@ module ActiveRecord table, arguments = args.shift, args method = :"#{command}_sql" - if respond_to?(method) + if respond_to?(method, true) send(method, table, *arguments) else raise "Unknown method called : #{method}(#{arguments.inspect})" |