3.1 - CoffeeScript in view templates

With rjs we did this: # app/views/products/update.rjs page.replace_html "products", render(@products)

With jquery and ujs we do this: # app/views/products/update.js.erb $("products").update("<%= escape_javascript(render(@products)) %>")

How are we going to accomplish something similar in Rails 3 with CoffeeScript?

I’m not sure it would be any different in CoffeeScript.

I think the syntax for calling a function is the same.

I think your right, but unless I'm missing something, I don't think you can include eruby tags inside of coffeescripts.

With rjs we did this:

app/views/products/update.rjs

page.replace_html “products”, render(@products)

With jquery and ujs we do this:

app/views/products/update.js.erb

$(“products”).update(“<%= escape_javascript(render(@products)) %>”)

How are we going to accomplish something similar in Rails 3 with

CoffeeScript?

Curtis, it should work as it did in Rails 3.0. Thus, I would give it a try in your existing Rails application.

Good luck,

-Conrad