2011-12-06 10 views
0

想必我的JavaScript文件都失去了太多......轉換的Rails 3.0.9到Rails 3.1.1和失去了我的樣式表

我從公衆移動樣式表/到App /資產/樣式表(FYI沒有發現他們在公共/資產中)。

搜索上的錯誤困惑我更多...

錯誤是ActionController的:: RoutingError(無路由匹配[GET] 「/assets/application.css」)

我純Rails 3.1應用程序的路線不提資產,但它工作正常。

application.css的內容

/* 
* This is a manifest file that'll automatically include all the stylesheets available in this directory 
* and any sub-directories. You're free to add application-wide styles to this file and they'll appear at 
* the top of the compiled file, but it's generally better to create a new file per style scope. 
*= require_self 
*= require_tree . 
*/ 

不知道還有什麼我應該把這裏除了我在下列指示(可能不是很好):Upgrade Rails 3 to 3.1

+0

只有在我去http:// localhost:3000/assets/application.js – ScottJShea

回答

1

與資產管道的Rails 3.1啓用,所有資源(javascript,css和圖像)均可通過瀏覽器中的assets路徑進行訪問,不再像以前那樣通過javascriptsstylesheets訪問。這是因爲Rails操縱你的資產(編譯,捆綁和縮小)。

一定要注意Railscasts episode on the Asset Pipeline

+0

後工作我猜你可以說這有助於當我去http:// localhost:300/assets/application.css文件編譯後,我可以在應用程序中看到它們 – ScottJShea

0

http://ruby.railstutorial.org/chapters/rails-3-1#to

這裏是爲那些降落在這裏尋求幫助遷移到另一個3.1很好的資源。邁克爾哈特爾經歷了一個逐步的過程升級現有的應用程序導軌3.1

這是我幾個星期前,當我有這個確切的問題時找到答案。