2011-12-08 21 views
1

錯誤的參數數目(2 1) 提取的源(圍繞線#5):引發ArgumentError(2 1):Rails3.1.0 <%= stylesheet_link_tag 「應用程序」 %>

<html> 
<head> 
<title>Assets</title> 
<%= stylesheet_link_tag 'application'%> 
<%= javascript_include_tag %> 
<%= csrf_meta_tags %> 
</head> 

I」已經試過:

<%= stylesheet_link_tag :all %> 

但我得到:

<link href='assets/all.css' ...> 

什麼困惑最深的是,我在我的Mac OS上運行的應用程序與ALM ost相同的配置,除了mysql & Gemfile,它運行良好,但是當我轉向centos5時,我得到了這些錯誤!

回答

0
<%= stylesheet_link_tag "application" %> 

應該沒問題。 Rails有一個資產管道將所有不同的樣式表合併爲一個生產環境。我認爲這是資產管道中的錯誤。

以下是有關這條管線一個很好的教程: http://railscasts.com/episodes/279-understanding-the-asset-pipeline

要可能改正錯誤看看配置/環境/ production.rb,並嘗試將它設置爲true

config.assets.compile = true 

另一個問題可能是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 . 
*/ 

但是,這些只是猜測......但我希望這會引導你走向問題的解決方案。

1

我也遇到過這個問題,結果證明這是由於在新的資產管道工作之前,一些代碼仍然針對舊的rails版本。具體地講,我有一個管理平臺使用該方法IMAGE_PATH插件使用兩個參數:

IMAGE_PATH(「database_refresh.png」,:插件=>「redmine_rate」)

此不再可能,而需要更換用明確計算插件特定路徑的代碼。我使用了基於wiki文檔的代碼:http://www.redmine.org/boards/3/topics/31445#Links-and-paths-to-plugin-assets

請注意,這個解決方案是針對redmine的問題,而不是rails,但事實上可能是相關的。

相關問題