Hey
Are there any plugins/extensions to resource_controller
I have been googling for the past half hour unable to find anything
that could fit -- but I recall having seen something somewhere. Please
update this discussion with any resources to make it findable in the
future.
Especially I'm looking for something that can make other formats as
part of resource_controller (xml). Like so, but DRYed up so it's not
repeated for each controller:
class ProductsController < ResourceController::Base
# Setup XML responses
index.wants.xml { render :xml => @products }
show.wants.xml { render :xml => @product }
new_action.wants.xml { render :xml => @product }
create.wants.xml { render :xml => @product, :status
=> :created, :location => @product }
create.failure.wants.xml { render :xml => @product.errors, :status
=> :unprocessable_entity }
destroy.wants.xml { head :ok }
update.wants.xml { head :ok }
update.failure.wants.xml { render :xml => @product.errors, :status
=> :unprocessable_entity }
# Response doesn't make sense for edit action
end
from
http://blog.billzajac.com/wordpress/articles/2008/02/23/using-xml-with-the-resource_controller-plugin/
Any help will be greatly appreciated,
Jesper Rønn-Jensen
Blog:
http://justaddwater.dk/