Skip to content

jim/siesta

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Siesta: A little REST for your controllers
=================

This plugin provides all the standard REST actions to controllers. Up until version 0.2, attributes to be passed to the model during mass assignment had to be explicitly defined, but I've now decided to reverse this decision.

There are several other excellent plugins that provide the same basic functionality (make_resourceful, restful_controller), but I don't really like defining my controller behavior using a DSL or using before/after filters to perform work that really ought to be done in the body of an action method. 

I prefer writing my controllers in Ruby, and using language level mechanisms such as redefining a method and calling super as needed. I find this makes it easier to understand what an action is doing, and also allows for the most flexibility.

This is the stable branch, which should always have good spec coverage. To run the specs, run rake spec from inside test_app. New in this version (0.3) is a new syntax that uses a modified subclassing in place of the old declarative syntax. This change was made to allow Siesta controllers to be easily sub-classed themselves.


Example
=======

The simplest use case is like so:

  class PencilsController < Siesta::Controller(:pencils)
  
  end
  
Namespaced models are supported, and nested resources work as you'd expect:
  
  class SpoonsController < Siesta::Controller(Dinner::Napkin, Fancy::Spoon)
  
  end
  
For more examples, check out the specs. They are located in test_app/specs.


Inspiration
===========

Siesta was originally influenced by Brendan Baldwin's rest_easy (http://github.com/brendan/rest_easy). Siesta was created partially as a personal exercise to force myself to really think about how the ultimate REST controller library would behave, at least from my point of view.


Copyright (c) 2009 Jim Benton, released under the MIT license

About

A little REST for your controllers

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages