restful_rickets provides a generator that creates an entire set of RESTful CRUD cycle for a resource with a slick interface resembling the javascript Ext library, but without using that framework. We use jQuuery instead. This generator approach is better than using a plugin such as ActiveScaffold or Hobo because our solution results in clean Rails files, whereas ActiveScaffold and Hobo modify Rails conventions. This makes our generator approach easier for Rails developers to work with — no surprises.
#> ruby script/plugin install git://github.com/clr/restful_rickets.git
#> rake rickets:assets
The lib will be picked up automatically when Rails loads. This plugin is a standard Rails generator, and works by invoking:
#> ruby script/generate ricket ModelName [attribute:type attribute:type ...]
See the example below for more details.
Click on the image for a live example:
I created the above application with just the following commands, copied from my bash history, using Rails v2.1:
rails ./rickets_demo
cd rickets_demo/
rake rails:freeze:edge
script/plugin install git://github.com/dchelimsky/rspec.git
script/plugin install git://github.com/dchelimsky/rspec-rails.git
script/generate rspec
script/plugin install git://github.com/mislav/will_paginate.git
script/plugin install git://github.com/aaronchi/jrails.git
script/plugin install git://github.com/clr/restful_rickets.git
rake rickets:assets
script/generate ricket Dog name:string breed_id:integer adult:boolean description:text
rake db:create
rake db:migrate
script/server
And then I can navigate to the running app at http://localhost:3000/dogs and add dogs.
Jake edited this file.
And again and again