I posted earlier about a problem I was having with the various remote
view methods escaping all the javascript in my callbacks. I was quickly
informed that that’s just what they do, and offered some workarounds.

However, in actually working with this, I’m finding that this one little
thing is forcing me to write some REALLY ugly code. Where I thought I
could specify an updater with some fairly sophisticated view
post-processing in my view, I am forced to write procedural code in my
controllers.

If I wanted to write code that ugly, I would have stuck with PHP.

There’s got to be a way to stop e.g. link_to_remote from escaping the
javascript specified in the callbacks. This behavior dramtically
reduces the elegance of these otherwise beautiful methods.

I’ve done some digging through the docs and even some of the code, but
nothing really jumped out at me. Can someone more familiar with these
helpers please give me some suggestions?

Can you post your code that you’re having a problem with? why can’t you
have
your callbacks call javascript methods and in the methods do all the
complex
javascript stuff instead of putting all the complex javascript stuff in
the
callback parameter?

What I’m trying to do is send the contents of ruby variables to the
javascript code as literals. It seems like a perfectly natural thing to
do, but the quote escaping makes it impossible, yielding:

new Effect.Highlight(&squot;bar&squote;)

This works surprisingly frequently considering what it looks like, but
is unreliable, and just plain wrong.

Can you post your code that you’re having a problem with? why can’t you
have
your callbacks call javascript methods and in the methods do all the
complex
javascript stuff instead of putting all the complex javascript stuff in
the
callback parameter?

After all, it’s easy enough to put h() around your callback values if
you want it. However, doing so might break some existing code, so I’d
like peoples opinions on alternatives before I submit a patch.

I also started a ticket on Trac, which I will update with this info.

Any input from more experienced Ruby/Rails folks would be greatly
appreciated.