Problem with combining rails helper and javascript


#1

Hi!

I’d like to make ajax request after effect fade finishes. There’s a
callback in Effect class - afterFinish, but it requires the code to be
in function() {here}.

When i write :afterFinish => remote_function() it generates following
javascript code:
afterFinish: new Ajax.Updater()
and i need:
afterFinish: function() {new Ajax.Updater()}

How can i do it? I need to pass few values to the url and do few things
on onComplete callback, so i’d really like to use remote_function
helper. If Effect callbacks expect the code to be inside a function
shouldn’t visual_effect helper create this automatically?


#2

I figured it out:

def function_remote_function(options)
“function() {” + remote_function(options) + “}”
end

:slight_smile: