Simple Rest

* http://github.com/niquola/simple_rest

DESCRIPTION

ActionControllers helper methods for restful response handling

  • Just DRY respond_to do |format|; …; end;

  • Support for jsonp and pdf

  • Support json request work around though magic parameter _json, if generic json request is imposibble (for example when using jsonp)

INSTALL:

in config/environment.rb

config.gem 'simple_rest'

then

sudo rake gems:install

To handle uncatched exceptions restfully add this to ApplicationController

class ApplicationController < ApplicationController::Base
   rescue_exceptions_restfully
end

USAGE

Example:

def action 
  #fetch result
  options = {:status=>:ok,:serialize_opts=>some options will be passed to to_json or to_xml}
  simple_rest result,options
end

CHANGE LOG

  • 0.0.2 add json request magic parameter support

  • 0.0.3 propogate opts to render method if html

MORE

For more info see tests and source code :)