Submit_to_remote change from 2.1 to 2.2 now gives wrong number of arguments


#1

Hi,

this snippet

<%= submit_to_remote('create_button', 'Add Phone',
                                              :submit =>

“phone_form”,
:url =>
send( “#{@phonable_type.to_s.downcase.singularize}_phones_path”,
@phonable_id),
:method => “post”,
:html => {:class =>
‘submit’}
) %>

was working totally fine under 2.1.1,
it throws wrong number of arguments (3 for 2) on 2.2.2

submit_to_remote on 2.1.1
was

File

vendor/rails/actionpack/lib/action_view/helpers/prototype_helper.rb,
line 412

412: def submit_to_remote(name, value, options = {})
413: options[:with] ||= ‘Form.serialize(this.form)’
414:
415: options[:html] ||= {}
416: options[:html][:type] = ‘button’
417: options[:html][:onclick] = “#{remote_function(options)};
return false;”
418: options[:html][:name] = name
419: options[:html][:value] = value
420:
421: tag(“input”, options[:html], false)
422: end

while on 2.2.2 is

File

vendor/rails/actionpack/lib/action_view/helpers/prototype_helper.rb,
line 421
421: def submit_to_remote(name, value, options = {})
422: options[:with] ||= ‘Form.serialize(this.form)’
423:
424: html_options = options.delete(:html) || {}
425: html_options[:name] = name
426:
427: button_to_remote(value, options, html_options)
428: end

now it wraps the lower level button_to_remote,
but I don’t get why mine is failing,

looks like submit and button to remote should be the same,
but not sure what’s going on,

any help is appreciated,

Thank you,