Instead of
respond_to do |format|
format.html # show.html.erb
format.xml {render :xml => @item}
format.json {render :json => @item}
end
Use
respond_to do |format|
format.html
api_formats format, @item
end
Takes options
api_formats format, @item,
:status => :created, :location => @item
And blocks
api_formats(format) {head :ok}