Restful Controller plugin

Plugin details

a very bare bones abstraction of the RESTful actions in a Rails' resource

Websitehttp://rpheath.com/ Repositorygit://github.com/rpheath/restful_controller.git Author Ryan Heath Tags Rest LicenseMIT

Documentation

Install the plugin:
ruby script/plugin install git://github.com/rpheath/restful_controller.git

This is a very bare bones abstraction of the RESTful actions for a Rails resource controller. Nothing fancy. Supports pagination (for the index action, mainly) and custom Models (that don’t match the typical pattern – think of a SignupsController using a User model).

class ArticlesController < ApplicationController
  restful_controller :model => Post, :pagination => true
end


Notes:
* by default the model will be the singularized version of the controller (ArticlesController => Article)
* automatically sets the expected instance variable for your views depending on the action being rendered. For articles example, the “show” action would setup an @article variable, while the “index” action would setup an @articles variable, as you’d expect)
* “supports pagination” means a #paginated(params[:page]) method will be called on your model (you may need to add that)

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