rails coffeescript& haml包含错误

时间:2012-03-31 02:03:32

标签: ruby-on-rails-3 coffeescript haml

我正在使用Rails 3.1,并且在尝试使用任何jQuery扩展时我一直收到错误。

kintouch.js.coffee

jQuery ->
  $('.best_in_place').best_in_place()

index.html.haml

  = best_in_place contacts[0].label, :name, :display_as => :header_short, 
      :inner_class => "span2"

application.js

//= require jquery
//= require jquery_ujs
//= require jquery.purr
//= require best_in_place
//= require_tree .

kintouch.js错误

  (function() {

      jQuery(function() {
        return $('.best_in_place').best_in_place();
    Uncaught TypeError: Object [object Object] has no method 'best_in_place'
      });

    }).call(this);

但是,如果我像这样硬链接到javascript扩展名:

%script{:src => "https://raw.github.com/bernat/best_in_place/master/lib/assets/javascripts/best_in_place.js", :type => "text/javascript"} 

一切似乎都有效。

我呈现的脚本文件:

enter image description here

谢谢!

1 个答案:

答案 0 :(得分:0)

jQuery被加载两次,因此超过了骑行引导程序。