Skip to content

Do not override :remote option in form_for() #2094

Closed
dgeb opened this Issue Jul 15, 2011 · 1 comment

2 participants

@dgeb
dgeb commented Jul 15, 2011

In 3.0.9 and below, form_for() could accept a :remote option passed in either options or options[:html]. However, any :remote option passed in as options[:html][:remote] will now be ignored because of this line:
https://github.com/rails/rails/blob/master/actionpack/lib/action_view/helpers/form_helper.rb#L368

options[:html][:remote] = options.delete(:remote)

This seems especially arbitrary since the point of that line is to set options[:html][:remote] = options[:remote]. Furthermore, other methods such as link_to allow the :remote option to be passed in the same hash as other html options. After all, it is just shorthand for the data-remote html attribute.

I believe the following logic should be used instead:

options[:html][:remote] = options.delete(:remote) if options.has_key?(:remote)

I'd be glad to prepare a pull request if others agree.

@dgeb dgeb added a commit that referenced this issue Jul 15, 2011
@dgeb dgeb fixed problem in which options[:html][:remote] would be overridden in…
… form_for() - fixes #2094
c6d83ab
@dgeb
dgeb commented Jul 15, 2011

I've resolved this in #2095

@dgeb dgeb added a commit that referenced this issue Jul 16, 2011
@dgeb dgeb added test case for fix to issue #2094 455e321
@fxn fxn added a commit that referenced this issue Aug 13, 2011
@dgeb dgeb added test case for fix to issue #2094 28daa8b
@arunagw arunagw pushed a commit to arunagw/rails that referenced this issue Aug 14, 2011
@dgeb dgeb fixed problem in which options[:html][:remote] would be overridden in…
… form_for() - fixes #2094
f87b33d
@ttosch ttosch pushed a commit that referenced this issue Jan 19, 2015
@dgeb dgeb fixed problem in which options[:html][:remote] would be overridden in…
… form_for() - fixes #2094
232862e
@ttosch ttosch pushed a commit that referenced this issue Jan 19, 2015
@dgeb dgeb added test case for fix to issue #2094 558b6ca
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.