This project is archived and is in readonly mode.
sortable_element with no :url option
Reported by Hang | September 10th, 2008 @ 02:33 AM | in 2.x
I want to create a sortable_element which doesn't send an AJAX request onUpdate.
However, if the :url option is not included, then rails returns an error:
You have a nil object when you didn't expect it! You might have expected an instance of ActiveRecord::Base. The error occurred while evaluating nil.[]
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/url_rewriter.rb:95:in
rewrite_url'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/url_rewriter.rb:81:in
rewrite'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:616:in
url_for'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_view/helpers/url_helper.rb:76:in
send'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_view/helpers/url_helper.rb:76:in
url_for'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_view/helpers/prototype_helper.rb:461:in
remote_function'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_view/helpers/scriptaculous_helper.rb:144:in
sortable_element_js'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_view/helpers/scriptaculous_helper.rb:139:in
sortable_element'
app/views/photos/index.html.erb:34:in
_run_erb_47app47views47photos47index46html46erb'
app/controllers/photos_controller.rb:58:in
index' -e:2:in
load' -e:2
The solution I've found is to change like 144 of scriptaculous_helper from:
options[:onUpdate] ||= "function(){" + remote_function(options) + "}"
to
options[:onUpdate] ||= "function(){" + remote_function(options) + "}" unless options[:url].nil?
But I don't know if this will fix the problem in all cases.
Comments and changes to this ticket
-
Emilio Tagua September 12th, 2008 @ 02:50 PM
If you want to send a patch, start by reading this:
http://rails.lighthouseapp.com/p...
About fixing the problem in all cases, add tests proving your fix and run the current test suite for actionpack to be sure nothing has been broken.
Good luck!
-
josh December 20th, 2008 @ 05:19 PM
- State changed from new to incomplete
-
Ryan Bigg April 11th, 2010 @ 12:01 AM
- State changed from incomplete to stale
If anybody still wants this functionality please discuss the point further.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>