Man,WTH正在進行這項工作。你知道Rails 3.1中實際做了哪些事情?爲什麼= javascript_include_tag:默認不能在Rails 3.1的haml佈局中工作
<script src="/assets/defaults.js" type="text/javascript"></script>
就像他們在ESPN上說的那樣,「來吧,夥計。」
我知道資產不再被視爲二等公民。但似乎他們甚至無法在這位候選人中獲得綠卡。在新的應用/ assets/javascripts/application.js中:
// This is a manifest file that'll be compiled into including all the files listed below.
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
// be included in the compiled file accessible from http://example.com/assets/application.js
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// the compiled file.
//
//= require jquery
//= require jquery_ujs
//= require_tree .
Sooooo。我應該下載jQuery嗎?我該怎麼辦?因爲除了application.js之外,這個javascripts目錄中沒有任何內容。
加重。然而它是免費的,所以我怎麼抱怨?無論如何,這些問題似乎很基本,但我希望你能提供任何幫助。
謝謝RB。這讓我瘋狂。我想漂亮的腳手架還沒有趕上。我不能相信JS文件嵌入在寶石中。這對我來說似乎有點「神奇」。我無法弄清楚Sprockets如何知道如何看待那顆寶石,我不喜歡它。 – AKWF
由於提供的鏈接已損壞,因此以下是有關資產管道的rails文檔的鏈接:http://guides.rubyonrails.org/asset_pipeline.html –
謝謝@ t3__rry。我更新了鏈接。 –