RJS and variables help


#1

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 @employee.id, “some text…”

Looked and searched but little documentation at the mo especially in
RDocs.


#2

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

#3

They are ordinary views

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

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

#show.rjs
page.replace_html “user_#{@user.id}”, “You know where to find me”

Gokhan A.
Web D.
www.sylow.net