What do I need to do so that I can use CoffeeScript in the Rails JS views? For example:
def index
format.js { render :layout => false }
end
This is now working in Rails 3.2. For example, I have a resource named book. This resource has a file at app/views/books/index.html.erb with the following:
<%= link_to 'test me', new_book_path(color: 'blue'), remote: true %>
Then I have a file at app/views/books/new.js.coffee at ≈ with the following code:
test = ->
'this is a test'
console.log test()
console.log( "<%= params[:color] %>" )
I see:
'this is a test'
'blue'
in my browser console.