Restful Rails 1.2
January 22, 2007 § Leave a comment
One of the coolest new features of Rails 1.2 is the RESTful routing. In
particular, the new scaffold_resource generator makes it really easy
to mockup a basic resource-oriented web app with trivial amounts
of code. Check it out.
particular, the new scaffold_resource generator makes it really easy
to mockup a basic resource-oriented web app with trivial amounts
of code. Check it out.
# rails
1.2.1
# mongrel
1.0.1
1.2.1
# mongrel
1.0.1
$ rails
restful
$ cd
!$
$ script/generate scaffold_resource
Entry title:string content:text
published:date
# can now specify fields as
part of the generator
$ mate
config/database.yml
development:
adapter: sqlite3
dbfile:
db/restful_development.db
$ rake
db:migrate # note new syntax!
$
script/server -d
$ open
http://0.0.0.0:3000/entries/
$ curl
http://0.0.0.0:3000/entries/1.xml #automatic
formats
$ curl -I
http://0.0.0.0:3000/entries/1.xml # note Content-Type.
Leave a Reply