2012-03-31 57 views
0

我正在使用Rails 3.1,並在嘗試使用任何jQuery擴展時不斷收到錯誤消息。rails coffescript&haml include errors

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

謝謝!

+0

我更新了錯誤描述。謝謝 – 2012-03-31 11:58:33

+0

我所有的jQuery插件都打破了... – 2012-03-31 14:55:15

+0

你是如何在你的應用程序中安裝best_in_place.js的? – 2012-03-31 15:26:42

回答

0

jQuery被加載兩次,因此騎馬引導。