resource_controller update: Bug Fix, Generators, and Google Group!
A week after I released resource_controller, there are a few issues that needed to be resolved.
Specifying Actions
Hampton pointed out the fact that I hadn't mentioned any way of specifying which actions a controller should respond to. You might want to have a controller that only responds to show, and index, for example. It was possible (and documented - see the RDocs), but somewhat broken. This release fixes that bug.
You can either provide a list of actions, or use :all, :except => syntax.
class PostsController < ResourceController::Base
actions :show, :index
## .. or ..
actions :all, :except => :index
end
Generators
resource_controller comes with a scaffold_resource generator now. In the 1.2.3+ stream, it will override the built-in version. I figure - if you're using resource_controller, you probably won't have much need for the default one.
It's pretty clever, too. If you have Haml installed, it generates Haml. If you have Shoulda installed, it spits out functional tests that make use of Shoulda's wonderful should_be_restful macro (note: I'm not necessarily opposed to doing the same for RSpec, if there's demand - let me know). Otherwise, it spits out erb, and the same functional tests as the generator included with rails.
The syntax is exactly the same as the built-in generator.
script/generate scaffold_resource post title:string body:text
Get It
1.2.3+ Compatible
svn export http://svn.jamesgolick.com/resource_controller/tags/stable vendor/plugins/resource_controller
Edge/Rails 2.0 Compatible
svn export http://svn.jamesgolick.com/resource_controller/tags/edge_compatible/stable vendor/plugins/resource_controller
If you're looking for older versions, try browsing http://svn.jamesgolick.com/resource_controller/tags.
For more info, see the release announcement.
Community
I also wanted to announce that I've created a google group for resource_controller.
Come join it, and discuss what can be done to make r_c even better!