2011-07-25 72 views
0

我有控制器蔬菜。它有標準創建方法。Rails3 - 訪問控制器從非'新'行動創建方法

我要創建馬鈴薯行動,其中包含形式和使用蔬菜的創建方法。

土豆觀點,我有這樣的:

= form_for @vegetable, :url => '/vegetable/create/' do |f| 
    = f.text_field :color 
    = f.submit "Save" 

當我按下保存,我得到錯誤

ActiveRecord::RecordNotFound in VegetablesController#update 
Couldn't find Vegetable with ID=create 

它採用update,不create方法。我怎麼能說Rails發送表單到create的行動?

回答

0

你應該使用相應的:url => vegetable_path