Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ruby-on-rails-3/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 通过Rails中的视图加载.coffee文件_Ruby On Rails_Ruby On Rails 3_Coffeescript_Erb - Fatal编程技术网

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 工作