Forum: Ruby on Rails Problem with combining rails helper and javascript

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Szymon N. (Guest)
on 2006-05-31 20:56

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?
Szymon N. (Guest)
on 2006-05-31 23:39
I figured it out:

def function_remote_function(options)
  "function() {" + remote_function(options) + "}"

This topic is locked and can not be replied to.