Auto Rest plugin
Plugin details
Documentation
ruby script/plugin install http://autorest.googlecode.com/svn/trunk
For a complete test app, check downloads on http://autorest.googlecode.com/ for a complete sample app. that should be extracted to the root of the plugin. The sample app specs covers a great deal of the functionality that would be very difficult to spec without a complete rails app.
By using the ar_spec_scaffold generator, a controller with all the options ready for customize is generated.
The generator usage is the same as scaffold_resource:
ruby script/generate auto_rest ResourceName [optional_field_1:type] [...] [optional_field_n:type]
The optional fields are used _only_ to include them on the migration. This generator produces also the proper specs on RAILS_ROOT/spec folder. You can use the --skip-rspecing to skip the generation of rspec-based specs.
Don't forget to:
have rspec and rspec on rails plugins and have ran ruby script/generate rspec if you wish to use rspec.
Set the routes. AutoRest is currently developed with a maximum 2-level nesting of routes in mind. See http://weblog.jamisbuck.org/2007/2/5/nesting-resources
So it uses routes like
ActionController::Routing::Routes.draw do |map| search_opt= { :search => :get } map.resources :zones, :collection => search_opt do |zone| zone.resources :customers, :name_prefix => "zone_" end map.resources :customers, :collection => search_opt end
For the integrated ferret support, you should put a :search => :get route on the collection of resources, just like i did above. Also include acts_as_ferret plugin and acts_as_ferret on the model class of the resource.
Set the proper resource relationships on models (has_many / belongs_to)
Create an application layout. If you include a call to ar_breadcrumbs in your layout, breadcrumbs will be available (i would say this is only usefull when you are working with nested resources).
body <%= ar_breadcrumbs %> <%= yield %> body
Further Documentation
There is currently no advanced documentation for this plugin.
New documentationEdit plugin | Back in time (1 older version) | Last edited by: scott, 8 months ago

