Thursday, May 15, 2008

Give it a REST

So recently I learned what REST really meant. Basically it's CRUD+. This means you have Create, Read, Update, Delete, and then add in Index, Edit, & New. For some reason this is a big deal... I just thought that was a regular ol rails feature. But rest also involves using a resources map to do things like this:

map.resources :newsstory

Which then gives you access to things like

REST Examples
You get all this after map.resources :object
Path for the form to create a new object -> new_object_path
Path to create new object -> object_path (:method => :post)
Path to edit object -> edit_object_path(@object)
Path to send the edit form (update object) -> object_path(@object) (:method => :put)
Path to view object -> object_path(@object)