Forum: Ruby on Rails RJS and variables help...

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.
James W. (Guest)
on 2006-03-30 16:28
How can I get mt RJS template to accept a variable as the ID value?

Doing this works:
page.replace_html '1', "some text..."

This does not:

page.replace_html, "some text..."

Looked and searched but little documentation at the mo especially in
Martin Bernd S. (Guest)
on 2006-03-30 17:24
Not sure, since I didn't test this, but may this be a class mismatch
error? Can you try adding .to_s to your variable?

- Bernd
Gokhan A. (Guest)
on 2006-03-30 20:03
They are ordinary views

lets assume you have @employee in your action then you can use @employee
in your rjs

def show
   @user = User.find(params[:id])

page.replace_html "user_#{}", "You know where to find me"

Gokhan A.
Web D.
This topic is locked and can not be replied to.