# Submit\_to\_remote change from 2.1 to 2.2 now gives wrong number of arguments

**URL:** <https://www.ruby-forum.com/t/submit-to-remote-change-from-2-1-to-2-2-now-gives-wrong-number-of-arguments/159886>\
**Category:** Rails\
**Created:** [February 9, 2009, 7:56pm UTC](https://www.ruby-forum.com/t/submit-to-remote-change-from-2-1-to-2-2-now-gives-wrong-number-of-arguments/159886 "2009-02-09T19:56:40Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andres\_Paglayan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/8491ac/32.png) [@Andres\_Paglayan](https://www.ruby-forum.com/u/Andres_Paglayan)\
**Post date:** [February 9, 2009, 7:56pm UTC](https://www.ruby-forum.com/t/submit-to-remote-change-from-2-1-to-2-2-now-gives-wrong-number-of-arguments/159886/1 "2009-02-09T19:56:40Z")

</div>

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,
