Solutions Log

So I only have to figure things out once.

Basic CRUD Using REST in Rails

First, get on Edge Rails. Easiest way:

rake rails:freeze:edge
rake rails:update

Then generate some new-school scaffolding:

script/generate scaffold_resource ModelName

This generates a migration template for you. Use that to fill in the details then run rake db:migrate.

In app/views/ModelName, you’ll have to add the details of your model to the different forms. Something like this:

<div><label>Name: <%= f.text_field :name %></label></div>
<div><label>Description: <%= f.text_area :description %></label></div>

I still haven’t figured out how to get things to actually work.

Update 21.10.2006: My problem in getting things to work was a matter of putting my RESTful routes information at the top of the config/routes.db file. Top == higher priority.

Sources

Continued here

Comments