开发者

Rails3 - access to controller create method from not 'new' action

I have controller vegetable. It has standart new and create methods.

I want to create potato action, that contain form and using vegetable's create method.

In potato view i have this:

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

When i press save, i get error

ActiveRecord::RecordNotFound in VegetablesController#update  
Couldn't 开发者_如何转开发find Vegetable with ID=create

It uses update, not create method. How can i say Rails to send form to create action?


you sould use corresponded :url => vegetable_path

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜