2010-03-10 54 views
0

我正在爲Redmine製作一個簡單的時間表插件,在我嘗試使用幫助器之前,一切進展順利。在視圖中調用輔助方法時出現NoMethodError

助手:

module TimesheetHelper 
def first_day_in_week(datum) 
    return unless datum.kind_of? Date 
    datum - datum.wday 
end 
def last_day_in_week(datum) 
    return unless datum.kind_of? Date 
    datum + (6 - datum.wday) 
end 
end 

在視圖中我有 幫手 「時間表」

但我也試過

helper :timesheet 

helper TimesheetHelper 

在冷杉的index.rhtml裏它說

<h2><%= l :timesheet_for %> <% first_day_of_week @week %> <%=l :and %> 
<% last_day_of_week @week %></h2> 

和軌道牛逼線拋出的first_day_of_week @week

一個NoMethodError有我丟失的東西?

回答

2

你的方法

def first_day_in_week(datum) 

def first_day_of_week(datum) 

名稱是不一樣的,所以這種方法沒有找到^^

+0

感謝您指出我的巨大失敗。 +1耐心 – 2010-03-10 12:04:58

相關問題