Skip to content
ActionControllers helper methods for restful response handling
Ruby
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
lib
test
.gitignore
README.rdoc
Rakefile

README.rdoc

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}
  respond_with result,options
end

CHANGE LOG

  • 0.0.6 upgrade to Rails 3.1

  • 0.0.4 upgrade to Rails 3 (no backward compatibility)

  • 0.0.3 propogate opts to render method if html

  • 0.0.2 add json request magic parameter support

MORE

For more info see tests and source code :)

Something went wrong with that request. Please try again.