2010-12-09 43 views
0

我生成的模型和使用支架產生的命令視圖,但產生之後這個問題出現...Rails3中錯誤的form_for方法

顯示/home/coderx/development/avioapp/app/views/plains/_form.html.erb其中線#1提出:

undefined method `define_attribute_methods' for nil:NilClass 

提取的源(圍繞線#1):

1: <%= form_for @plain do |f| %> 
2: <% if @plain.errors.any? %> 
3:  <div id="error_explanation"> 
4:  <h2><%= pluralize(@plain.errors.count, "error") %> prohibited this plain from being saved:</h2> 
+0

@plain是否在控制器中正確設置? – Cory 2010-12-09 22:09:32

回答

1

葉氏,它是在控制器的一個問題,我一直在使用的Git分支時被..謝謝搞砸了什麼你的建議!

0

我也遇到過這種類型的錯誤。在我的情況下,這是由於一些保留關鍵字(作爲表字段)。

雖然你已經找到你的解決方案,但我認爲它可能會幫助其他人:)