Getting acquainted with REST


#1

I’ve been using RoR since 2.0 came out, and I’ve made several small
scale sites. Recently I’ve started trying to get into better habits, so
I’m now using rspec and cucumber with BDD to create my sites.

Another thing I’m trying to do is be faithful to the RESTful design.
I’ve got a small problem though that I’m not sure how to solve and still
be restful.

I’ve got a simple controller that will let users perform CRUD actions,
and I’ve got routes mapped out with

map.resources :events

This seems to work ok when testing with webrat and cucumber, but a
problem emerges when trying it from a browser:

events_path renders events/index as expected, however I’m planning to
use events_path with method POST to get to events/create. That will be a
form that will post to new_event (events/new).

Unfortunately, the browser (in this case firefox 3) doesn’t respect the
method argument to the link and just sends it as a GET.

Am I doing something totally crazy or have I just missed something?

I can post code if necessary but it really is vanilla stuff.

Grateful for any ideas.

~Matt


#2

Matt H. wrote:

method argument to the link and just sends it as a GET.

Am I doing something totally crazy or have I just missed something?

And as I thought, I was doing something incredibly stupid. Obviously I
should reverse the roles of create and new, I guess I shouldn’t drink
while I’m learning new methods :wink:

Sorry for the list pollution.