Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby Rails Routes and Resources A Route to a Delete Action Deleting Pages

Danish Saleem
Danish Saleem
7,965 Points

No route matches [DELETE] "/pages/4"

Hi when i apply the delete method and try to delete one of my record i get this error No route matches [DELETE] "/pages/4"

although i have already defined the route in route.rb file

plz help

Ethan Rivas
Ethan Rivas
9,979 Points

Can you tell me what your console returns if you enter this command?: rake routes

1 Answer

instead of custom routes use resources 'pages' in your route.rb file and define deleted method on that link which leads to delete a page like this <%= link_to 'Delete', page_path(some_page_id) method: :delete %>