lib/guillotine/adapters/riak_adapter.rb
# Fixes a bug in Guillotine 1.0.2 where the content type on url objects
# was not being set.  The ruby Riak::Client defaults to JSON, so
# strings were being saved as "somecode", which is unparseable by JSON.
Fixes a bug in Guillotine 1.0.2 where the content type on url objects
was not being set.  The ruby Riak::Client defaults to JSON, so
strings were being saved as "somecode", which is unparseable by JSON.
Fixes a bug in Guillotine 1 . 0 . 2 where the content type on url objects was not being set . The ruby Riak :: Client defaults to JSON so strings were being saved as " somecode " which is unparseable by JSON .
def fix_url_object(obj, data = nil)
      if data
        obj.content_type = PLAIN
        obj.data = data
        obj.store
        return obj
      end
      case obj.content_type
        when /json/ then fix_url_object(obj, JSON.parse(%({"data":#{obj.raw_data}}))['data'])
        when PLAIN  then obj
        else fix_url_object(obj, obj.data) 
      end
    end
def fix_url_object ( obj , data = nil ) if data obj . content_type = PLAIN obj . data = data obj . store return obj end case obj . content_type when / json / then fix_url_object ( obj , JSON . parse ( %({"data":#{obj.raw_data}}) ) [ 'data' ] ) when PLAIN then obj else fix_url_object ( obj , obj . data ) end end
Fixes a bug in Guillotine 1.0.2 where the content type on url objects
was not being set.
Fixes a bug in Guillotine 1 . 0 . 2 where the content type on url objects was not being set .
# old values had the right data but the content type was application/x-www-form-urlencoded
obj
<not_specific>
data
<not_specific>