Nested Resource - How to pass needed keys, and attribute to update?

Posted by Jason B on Stack Overflow See other posts from Stack Overflow or by Jason B
Published on 2012-11-07T16:58:50Z Indexed on 2012/11/07 16:59 UTC
Read the original article Hit count: 173

Filed under:

My nested resources are working for form_for updates, but I have a few toggles that I need to setup to change a status field. So I am using link_to, and accessing the 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

My question is: How can I also send along :approval_status = "1", with my link_to?

© Stack Overflow or respective owner

Related posts about ruby-on-rails