var blog_post_auto_completer = new Ajax.Autocompleter('blog_post',
'blog_post_auto_complete', '/posts.js?a=1&b=2', {method:'get'})
Notice that "&" in the path. When sent to the server, it get
parsed as "a=1" and "amp;b=2".
I think the script is correct because XHTML & to be coded as "&".
Is this a bug in Mongrel? Has anyone else dealt with this?
Not mongrel's fault. It doesn't know anything about & being encoded as & (that's just a detail of html/xml etc..., whereas mongrel just cares about http)
If anything it's probably the fault of text_field_with_auto_complete since if you're inside a cdata thing (like most javascript is) then you don't need to escape the &
If anything it's probably the fault of text_field_with_auto_complete
since if you're inside a cdata thing (like most javascript is) then
you don't need to escape the &
Indeed it's quite likely you're double-escaping the ampersand. Closely
inspect the rendered HTML source to verify.
This just gets sent to the index action, so that & is getting
gummed up somewhere between submit and the start of the action. But
where? This is a one-line hack to fix, but I'd rather see it working
correctly.