AutoRest, first public release, 31/10/2007 Simplify the development of rest based applications by using a generic controller implementation. Based on scaffold_resource of rails 1.2.3. With a single call of a class method, includes the default methods for a rest controller using user-supplied configuration. Smart defaults are generated for all the missing configuration parameters. Author Emmanuel Oga. http://EmmanuelOga.WordPress.com Usage For a complete sample app, check downloads on http://autorest.googlecode.com/. The sample app should be extracted to the root of the plugin. Its specs covers a great deal of the functionality that would be very difficult to test without a complete rails application. 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). AutoRest Test App <%= ar_breadcrumbs %>
<%= yield %> * Configure each controller at your heart's content