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
Post a Comment