small medium large xlarge

Generic-user-small
13 Aug 2008, 17:39
KenA (16 posts)

Hi. When doing the Depot app after the first scaffold and migration of Product model I decided to test one thing:

http://localhost:3000/products/2/edit

and

http://localhost:3000/products/edit/2

both shows the edit.html.erb file … is it right?

Samr_small_pragsmall
13 Aug 2008, 17:55
Sam Ruby (634 posts)

Chapter 20 has the details on why this is, but the short version is that if you type the command rake routes, amongst the output you will see the following:

edit_article GET /products/:id/edit {:controller=>"products", :action=>"edit"}

as well as the following:

/:controller/:action/:id

So, while the two URLs you mentioned will match separate rules, the end result is that the same controller, action, and id results from either.

Generic-user-small
13 Aug 2008, 20:30
KenA (16 posts)

Thanx Sam, i´ll wait until i get to chapter 20 although i did a quick sneak at and saw that the chapter is quite interesting, plus the thing called REST … actually REST appears to be there for ages and just now we are going to make use of it … we were re-inventing the wheel before?

I´m finally getting the idea between a Post (insert) and Get (select), heheh

You must be logged in to comment