I'm using Rails 3.1 and trying to add some ajax functionality (using jquery + coffeescript).
I have a respond_to block in the controller
def edit
@variable = 123
respond_to do |format|
format.js
end
end
and a file app/views/test/edit.coffee.js
The file edit.coffee.js is be picked up and is running correctly, but I can't work out how to access @variable from the javascript.
Is there a way to pass this variable in to the js.coffee script? or do update an element on the page so that I can access it from the js.coffee?