-
Notifications
You must be signed in to change notification settings - Fork 330
RESTful Scaffolding
aspiers edited this page Jan 13, 2012
·
4 revisions
ActiveScaffold handle all the REST operations. Active scaffold supports by default the following formats :
- HTML
- js
- XML
- json
- yaml
map.resources :users, :active_scaffold => true
or on Rails 3:
resources :users do as_routes end
We suppose a common "thing" resource.
GET http://my-server/things/1.xml
GET http://my-server/things/3.yaml
GET http://my-server/things.yaml?property=special
- PUT
http://my-server/things.xml
- data =
<?xml version='1.0' encoding='UTF-8'?><record><designation>special thing</designation><quantity>3</quantity></record>
- content_type => :xml
- PUT
http://my-server/things.json
- data =
{record:{"designation":"special thing","quantity":3}}
- content_type => :json