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

python - What's the Pythonic way to report nonfatal errors in a parser? -

sql server - Deadlock occuring in Clustered Columnstore index -

angular - Converting AngularJS deffered promise to AngularX observable for JSOM -