我的嵌套资源正在用于form_for更新,但是我需要设置几个切换来更改状态字段。所以我使用link_to,并访问url helper。
link_to "toggle", edit_project_expense_path(@project[:id],expense_item[:id])
的routes.rb
resources :projects do
resources :expenses
end
match '/submit_expense/:id' => 'expenses#submit_expense', :as => 'submit_expense'
rake routes
edit_project_expense GET /projects/:project_id/expenses/:id/edit(.:format) expenses#edit
我的问题是:我怎样才能发送:approval_status =“1”,带有我的link_to?
答案 0 :(得分:3)
link_to "toggle", edit_project_expense_path(@project[:id],expense_item[:id], approval_status: 1)