Non integer ID and rails with ActiveResource
I have been fighting with ActiveResource for the last couple of days. Here at work we are using this huge Object Cache to stuff data into. The front end is a rails app that talks to the cache through ActiveResource and REST.
The issue I had was that the ID which was returned wasn’t an INT, the cache assigns a UUID as the id.
The error kept saying it was in:
/vendor/rails/actionpack/lib/action_controller/mime_responds.rb:163:in `respond’
Basicly the mimetype discovery for my controller is hosed with string id’s
Broken:
respond_to do |format|
if @vendor.update_attributes(params[:vendor])
flash[:notice] = ‘Vendor was successfully updated.’
redirect_to edit_vendor_url(@vendor)
format.html { redirect_to edit_vendor_url(@vendor) }
format.xml { head :ok }
else
…
end
Once I changed it to:
if @vendor.update_attributes(params[:vendor])
flash[:notice] = ‘Vendor was successfully updated.’
redirect_to edit_vendor_url(@vendor)
else
…
end
It worked just fine.