diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2013-11-14 15:31:27 -0800 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2013-11-14 15:31:27 -0800 |
commit | 07996ebc50f5906dbecc481ac83ed2adefc9ec6e (patch) | |
tree | a6275a518624722710cae2aa29ae18d5b4204cc9 | |
parent | 421c81bd1875eb4e163bea8ce18b1ae9c2224e7d (diff) | |
download | rails-07996ebc50f5906dbecc481ac83ed2adefc9ec6e.tar.gz rails-07996ebc50f5906dbecc481ac83ed2adefc9ec6e.tar.bz2 rails-07996ebc50f5906dbecc481ac83ed2adefc9ec6e.zip |
Revert "Used Yield instead of block.call" -- this causes all of atom_feed_helper_test.rb to fail with "SystemStackError: stack level too deep".
This reverts commit d3a1ce1cdc60d593de1682c5f4e3230c8db9a0fd.
4 files changed, 9 insertions, 9 deletions
diff --git a/actionpack/lib/action_controller/metal/mime_responds.rb b/actionpack/lib/action_controller/metal/mime_responds.rb index bcd21dbabc..84ade41036 100644 --- a/actionpack/lib/action_controller/metal/mime_responds.rb +++ b/actionpack/lib/action_controller/metal/mime_responds.rb @@ -358,10 +358,10 @@ module ActionController #:nodoc: # # Sends :not_acceptable to the client and returns nil if no suitable format # is available. - def retrieve_collector_from_mimes(mimes = nil) #:nodoc: + def retrieve_collector_from_mimes(mimes=nil, &block) #:nodoc: mimes ||= collect_mimes_from_class_level collector = Collector.new(mimes) - yield(collector) if block_given? + block.call(collector) if block_given? format = collector.negotiate_format(request) if format diff --git a/actionview/lib/action_view/helpers/atom_feed_helper.rb b/actionview/lib/action_view/helpers/atom_feed_helper.rb index 1df52cd4b5..af70a4242a 100644 --- a/actionview/lib/action_view/helpers/atom_feed_helper.rb +++ b/actionview/lib/action_view/helpers/atom_feed_helper.rb @@ -135,11 +135,11 @@ module ActionView # Delegate to xml builder, first wrapping the element in a xhtml # namespaced div element if the method and arguments indicate # that an xhtml_block? is desired. - def method_missing(method, *arguments) + def method_missing(method, *arguments, &block) if xhtml_block?(method, arguments) @xml.__send__(method, *arguments) do @xml.div(:xmlns => 'http://www.w3.org/1999/xhtml') do |xhtml| - yield(xhtml) + block.call(xhtml) end end else diff --git a/activerecord/test/cases/migrator_test.rb b/activerecord/test/cases/migrator_test.rb index eaaf996dbb..3f9854200d 100644 --- a/activerecord/test/cases/migrator_test.rb +++ b/activerecord/test/cases/migrator_test.rb @@ -346,11 +346,11 @@ module ActiveRecord end private - def m(name, version) + def m(name, version, &block) x = Sensor.new name, version x.extend(Module.new { - define_method(:up) { yield(:up, x); super() } - define_method(:down) { yield(:down, x); super() } + define_method(:up) { block.call(:up, x); super() } + define_method(:down) { block.call(:down, x); super() } }) if block_given? end diff --git a/railties/lib/rails/generators/actions.rb b/railties/lib/rails/generators/actions.rb index 4757c79ac6..366c72ebaa 100644 --- a/railties/lib/rails/generators/actions.rb +++ b/railties/lib/rails/generators/actions.rb @@ -84,10 +84,10 @@ module Rails # environment(nil, env: "development") do # "config.autoload_paths += %W(#{config.root}/extras)" # end - def environment(data = nil, options = {}) + def environment(data=nil, options={}, &block) sentinel = /class [a-z_:]+ < Rails::Application/i env_file_sentinel = /Rails\.application\.configure do/ - data = yield if !data && block_given? + data = block.call if !data && block_given? in_root do if options[:env].nil? |