model view controller - Rails: Link to custom method with variables -


i have simple custom method

def delete(foo, bar)   @foo = foo.find(foo)   @bar = bar.find(bar)   destroy end 

and want call view link:

<%= link_to 'delete', delete_articles_path(number: @number, tag: @tag), method: put, data: { confirm: 'are sure?' } %> 

the route:

  resources :articles      collection       put '/delete', to: "articles#delete", as: "delete_article"     end   end 

i tried like here(stack overflow) says should pass data through params, while want pass method variables.

you don't need arguments. pass variables need via params hash.


Comments

Popular posts from this blog

ios - Assigning a value out of array of arrays, using section in Xcode -

r - XTS-File doesnt work for quantstrat -