0
我有以下simple_form時:未定義的方法錯誤使用simple_form(新手)
= simple_form_for instance do |f|
= f.input :update_resolution, collection: 1..10
= f.button :submit
它引發錯誤:
undefined method `update_resolution' for #<Instance:0x007f0c07329640>
在instances_controller.rb
我:
def update_resolution
render nothing: true, status: 200, content_type: 'text/html'
end
而且我不是100%確定最好放入routes.rb
。
目標:我試圖做一個自動提交的下拉,讓用戶運行update_resolution與某些參數。
問題:
- 爲什麼它拋出這個錯誤&我該如何解決?
- 什麼是首選
routes.rb
策略?
可以請您出示您的型號代碼嗎? –
update_resolution是您試圖在視圖中調用的控制器方法嗎? –
在你正在嘗試打電話給**控制器操作**的窗體中,......這是什麼! :/ –