Forum: Ruby on Rails submit_to_remote change from 2.1 to 2.2 now gives wrong number of arguments

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Andres Paglayan (Guest)
on 2009-02-09 20:56
(Received via mailing list)
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,
This topic is locked and can not be replied to.