dimanche 4 octobre 2015

Confusion with path name variable in routes.rb and .html.erb

So in my routes.db file I map the uri "todos/delete" to "todos#delete", and assign it as the variable :delete.

match "todos/delete" => "todos#delete", :as => :delete, via: [:get, :post]

How come in my index.html.erb file, when I want to use the link_to helper method, I have to use the variable delete_path instead of delete?

<%= link_to "Delete last todo", delete_path %>

Aucun commentaire:

Enregistrer un commentaire