2013-01-12 16 views
0

我正在嘗試運行基於#381 railscast情節的簡單javascript文件。但是,當我在我的JavaScript文件中放置警報時,它在加載我的頁面時不顯示。我確定文件本身是在我在視圖源中檢查時加載的。任何想法,爲什麼它不加載?.js.coffee文件未在rails應用程序中運行

的application.js:

// This is a manifest file that'll be compiled into application.js, which will include all the files 
// listed below. 
// 
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, 
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path. 
// 
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the 
// the compiled file. 
// 
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD 
// GO AFTER THE REQUIRES BELOW. 
// 
//= require jquery 
//= require jquery_ujs 
//= require jquery-fileupload/basic 
//= require jquery-fileupload/vendor/tmpl 
//= require js-routes 
//= require twitter/bootstrap 
//= requre_self 
//= require_tree . 

images.js.coffee:

jQuery -> 
    alert("hello world") 
    $('#new_image').fileupload 
    dataType: "script" 
+1

有沒有在頁面上的任何JavaScript警告/錯誤? –

+0

我不這麼認爲: 已啓動GET「/assets/images.js?body=1」for 127.0.0.1 at 2013-01-12 11:34:50 -0500 已投放資產/images.js - 304沒有已修改(0ms) – scientiffic

+0

瀏覽器中的JS控制檯如何? –

回答

2

嘗試去除的application.js導致JS錯誤的文件。您也可以嘗試刪除require_tree .,遞歸地包含app/assets/javascripts中的所有文件,但如果您這樣做,則必須手動添加需要包含的所有文件。

相關問題