Query broke when I changed my routing I think

Ran into a curious situation that I don’t know how to resolve.
ActiveLDAP gem updated which took me from Rails 3.1.1 to 3.2.8.

ActiveLDAP has ID’s with ‘.’ in them so I had to change my routes to
accommodate.
<snip from config/routes.rb>
match ‘/:controller(/:id(/:action))’, :constraints => { :id =>
/[^/]+/ }

This caused a problem with my ajax because apparently the ajax sends the
data in the form of /:controller/:action/:id so I added
<another snip from config/routes.rb>
match ‘/permissions/add_member’ => ‘permissions#add_member’
match ‘/permissions/remove_member’ => ‘permissions#remove_member’
</another snip>

Which is fine to the controller but now (the database changes indeed
occur), the route back doesn’t update the screen properly though
according to firebug, the HTML is getting returned the same as always.

The error in the console shows me:
. Uncaught TypeError: Object # has no method ‘getAttribute’
application.js:15
. G.selectors.filter.ID.napplication.js:15
. uapplication.js:15
. htapplication.js:15
. u.querySelectorAll.htapplication.js:15
. Gapplication.js:15
. u.querySelectorAll.G.matchesSelectorapplication.js:15
. v.fn.extend.closestapplication.js:15
. (anonymous function)drag_drop.js:201
. v.Callbacks.lapplication.js:14
. v.Callbacks.c.fireWithapplication.js:14
. Tapplication.js:16
. v.support.ajax.v.ajaxTransport.send.rapplication.js:16

and the unchanged drag_drop.js which used to work fine is

$(function() {
$("[id^=role-]").on(“mouseenter”, function() {
!$(“li:first”, this).hasClass(“ui-draggable”) && $(“li”,
this).draggable({ containment: ‘#priv_drop’ });
});
$("#priv_drop").droppable({
drop: function(event, ui) {
var droppriv = “#role-” + ui.draggable.attr(“data-role”);
$(this).addClass(“ui-state-highlight”);
$.post("/permissions/remove_member/", {
“id”: ui.draggable.attr(“data-del”)
}, function(data) {
var html = $(data);
$("#priv_users").empty().append(html.closest("#priv_users").children());
$(droppriv).empty().append(html.closest(droppriv).children());
$("#messages1").replaceWith(html.closest("#messages1"));
});
}
});

and the error is highlighting the line
$("#priv_users").empty().append(html.closest("#priv_users").children());

the controller & the view (actually, the partial here) are unchanged
from previously working.

I’ve been struggling with this for many hours and haven’t been able to
solve.

I do have a jsfiddle on this… http://jsfiddle.net/white_n_az/egHfd/6/

Can anyone toss me a bone here?


Craig W. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[email protected]
1.800.869.6908 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Register Now!
TTI Winners’ Conference 2013
January 20th - 22nd
The Earlier You Register the More FREE Product You Receive
Click here for more information!

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs