2013-05-08 88 views
0

我有一個軌道電影的形式,其中一列被稱爲年。 在我的導軌形式,它顯示爲這樣Rails管理員窗體錯誤

<%= f.collection_select :year_id, Year.all, :id, :year %> </div><br /> 

,並輸出該

enter image description here

但在Rails的管理,形式爲電影上,這些年來被顯示爲這樣

enter image description here

那麼我怎樣才能讓它顯示實際的年份數(2012年),而不是年#3

回答

0

在應用程序/模型/ year.rb

def name 
    year 
end 

或者使用label_method指定要被用作類的所有實例的標記方法,該方法。