Resource Hacks plugin

Plugin details

resource_hacks is a plugin that extends edge Rails’ new restful routes implementation. While the current opinion of the core team is that we should only use member resources with a numeric id, resource_hacks allows Rails to support arbitrary an arbitrary member path.

Websitehttp://www.jvoorhis.com/articles/2006/08/01/announcing-resource_hacks Repositoryhttp://svn.planetargon.org/rails/plugins/resource_hacks Author Jeremy Voorhis Tags resource LicenseMIT

Documentation

Install the plugin:
ruby script/plugin install http://svn.planetargon.org/rails/plugins/resource_hacks

Allow me to illustrate:

  map.resources :entries


gives us the member path /entries/1 where 1 is the value of params[:id]. With resource_hacks, you can still use a numeric id, but also declare an arbitrary member path like so:

map.resources :entries,
  :member_path => '/entries/:year/:month/:day/:permalink'


This gives us the member path /entries/2006/8/1/announcing_resource_hacks rather than /entries/1.

With this routing definition, you may send an HTTP request with the PUT method to update the Entry via EntriesController#update. The same goes for DELETE. The collection found at /entries will not be affected by resource_hacks.

Further Documentation

There is currently no advanced documentation for this plugin.

New documentation

Edit plugin | (0 older versions) | Last edited by: hardway, about 1 year ago