From a6cfb4e0e4209e06b4ba561b688ee2c3b942e3dd Mon Sep 17 00:00:00 2001 From: Rick Olson Date: Sun, 19 Mar 2006 19:38:38 +0000 Subject: Fix mixed case enumerable methods in the JavaScript Collection Proxy (closes #4314) [codyfauser@gmail.com] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3984 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/lib/action_view/helpers/prototype_helper.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'actionpack/lib/action_view/helpers') diff --git a/actionpack/lib/action_view/helpers/prototype_helper.rb b/actionpack/lib/action_view/helpers/prototype_helper.rb index 35a671c081..3d15f2ecfd 100644 --- a/actionpack/lib/action_view/helpers/prototype_helper.rb +++ b/actionpack/lib/action_view/helpers/prototype_helper.rb @@ -807,7 +807,7 @@ module ActionView end class JavaScriptCollectionProxy < JavaScriptProxy #:nodoc: - ENUMERABLE_METHODS_WITH_RETURN = [:all, :any, :collect, :map, :detect, :find, :findAll, :select, :max, :min, :partition, :reject, :sortBy] + ENUMERABLE_METHODS_WITH_RETURN = [:all, :any, :collect, :map, :detect, :find, :find_all, :select, :max, :min, :partition, :reject, :sort_by] ENUMERABLE_METHODS = ENUMERABLE_METHODS_WITH_RETURN + [:each] attr_reader :generator delegate :arguments_for_call, :to => :generator @@ -865,7 +865,7 @@ module ActionView method_args = arguments_for_call options[:method_args] # foo, bar, function method_args << ', ' unless method_args.blank? add_variable_assignment!(options[:variable]) if options[:variable] - append_enumerable_function!("#{enumerable}(#{method_args}function(#{yield_args}) {") + append_enumerable_function!("#{enumerable.to_s.first}#{enumerable.to_s.camelize[1..-1]}(#{method_args}function(#{yield_args}) {") # only yield as many params as were passed in the block yield *options[:yield_args].collect { |p| JavaScriptVariableProxy.new(@generator, p) }[0..block.arity-1] add_return_statement! if options[:return] -- cgit v1.2.3