lib/patches/ar3/base.rb in sk-api-1.1.0 vs lib/patches/ar3/base.rb in sk-api-1.1.1

- old
+ new

@@ -3,11 +3,14 @@ # Some changes might be kicked when AR 3.0 is out class Base # override ARes method to parse only the client part def load_attributes_from_response(response) - if response['Content-Length'] != "0" && response.body.strip.size > 0 + if (response['Transfer-Encoding'] == 'chunked' || + (!response['Content-Length'].blank? && response['Content-Length'] != "0")) && + !response.body.nil? && response.body.strip.size > 0 load( self.class.format.decode(response.body)[self.class.element_name] ) + @persisted = true end end # Overridden to grab the data(= clients-collection) from json: # { 'collection'=> will_paginate infos, \ No newline at end of file