Ruby on rails 通过Rails中的视图加载.coffee文件
我的控制器如下:Ruby on rails 通过Rails中的视图加载.coffee文件,ruby-on-rails,ruby-on-rails-3,coffeescript,erb,Ruby On Rails,Ruby On Rails 3,Coffeescript,Erb,我的控制器如下: class CommentLoaderController < ApplicationController respond_to :js def show puts 'here' @client_id = params[:id] respond_with @client_id end end class CommentLoaderController
class CommentLoaderController < ApplicationController
respond_to :js
def show
puts 'here'
@client_id = params[:id]
respond_with @client_id
end
end
class CommentLoaderController
它加载一个.js文件,其中包含一些.erb标记。我想加载一个CoffeeScript文件,动态编译成JS。Rails 3有可能做到这一点吗?我想我的一位同事今天写的这篇博文可能会有所帮助 事实证明Rails不会编译CoffeeScript模板 默认设置,但您可以神奇地安装gem 工作