2012-05-01 46 views
4

处理Rails 3.1资产管道的第一天就击败了!Rails 3.1 Asset Pipeline预编译失败,asset_path参数错误

这里是由资产抛出错误的长线最新:上机生产预编译:

wrong number of arguments (1 for 2) for 'asset_path'

这发生在application.css文件(我认为这是第一它正在尝试)。

这是我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 . 
*/ 

.account-badge 
{ 
    background-color: #B94A48 !important 
} 

.centered { 
    float: none; 
    margin-left: auto; 
    margin-right: auto; 
} 

.container[role="main"] { 
    padding-bottom: 300px; 
} 

.page-footer { 
    border-top: 1px solid #EEEEEE; 
    padding-top: 17px; 
} 

一提的是,我在一个全新的应用程序中使用twitter-bootstrap-rails(未升级)

+0

这是一个在被barfing您的.css文件到asset_path,发现所有“asset_path”通话中你的CSS调用文件并发布他们 – RadBrad

+0

很奇怪,我收到了同样的错误。 'asset-path'需要2个参数,但第二个参数是什么。 “图像”的作品,也是“是”的作品,在哪里使用?看着github rails/sass-rails,它显示1个参数https://github.com/rails/sass-rails/search?utf8=%E2%9C%93&q=asset-path – Chemist

回答

3

bootstrap_and_overrides.css.less看看可能是重要的文件,其中包含您的application.css文件的链轮(*= require_tree)。

我想通过包括@iconSpritePath@iconWhiteSpritePath来定位错误。

编辑: 该方法需要两个参数:

asset-url("rails.png", image) # becomes url(/assets/rails.png) 
asset-path("rails.png", image) # becomes "/assets/rails.png" 

希望帮助

+0

我想这就是它的原因吧包含你指的是什么。然而,奇怪的一点是,错误状态asset_path需要2个参数,只有1。我的应用程序中的所有asset_path实例有1个参数,我不知道这个第二个参数应该是什么,因为这个函数只有一个参数。 – Khash