Update: Please see http://sample.caboo.se/ for the latest version of our sample apps.
Get it here:
svn://caboo.se/plugins/court3nay/empty_apps/restful_auth_rspec
Contact the author (you'll need to add .com to the email):
<court3nay+sra@gmail>
Requirements:
You'll need a few gems.
- rspec
- image_science OR rmagick
Changeset:
- removed 'with_scope' and replaced it with protocool's awesome polymorphic controller code.
- added his resource_fu plugin for restful helper methods
The most recent changes are due to Trevor/protocool, the author of the resource-fu plugin. It seems like nested resources in a polymorphic form are extremely difficult to implement in a clean manner.
Here's a snippet of code:
delegate :images, :to => '@attachable'
helper_method :images
def load_image
@image = images.find(params[:id])
end
Beautiful. It relies on the images controller being an abstract class, defining @attachable in the inherited class, and delegating "images" helper method to that @attachable object.
From the readme:
Caboose Sample App
This is a sample application containing a bunch of useful plugins and code to help you get started quicker.
It is intended to be an example of "better practices", but with the intention of ultimately being
"best practice" through collaboration and iterative improvement.
The application implements many of the basic and advanced features I find myself using in every new project:
- a user model with a few extra fields (last login, timezones)
- restful authentication
- simple authorization (can't edit other's profiles)
- full timezone support
- basic views implemented with Yahoo! YUI CSS grids
- behavioral testing with rspec, including good example of mocking in controller specs
- exception notification (remember to change the email address in environment.rb)
- nested resources (user/images) which can easily be extended (e.g. product/images)
- polymorphic image model
- around_filters to set and clear request-specific data
Many of the enhancements to the stock plugins are ripped from my private codebase, as yet unseen by the world :)
TODO:
Sample controllers and models More useful plugins Good examples of ajax Better list of requirements (required gems, etc)
TODONE:
x Polymorphic Image model using attachment_fu