riak-ripple / ripple

A rich Ruby modeling layer for Riak, Basho's distributed database
Other
619 stars 152 forks source link

Add content_type to Basic Example. #257

Closed czarneckid closed 12 years ago

czarneckid commented 12 years ago

Without the content_type, I get the following error as the initial object is created with a content type of application/json.

ruby-1.9.3-p0 :007 > object = bucket.get_or_new("index.html")
 => #<Riak::RObject {doc,index.html} [application/json]:nil> 
ruby-1.9.3-p0 :008 > object.data = "<html><body>Hello, world!</body></html>"
 => "<html><body>Hello, world!</body></html>" 
ruby-1.9.3-p0 :009 > object.store
JSON::ParserError: 743: unexpected token at '"<html><body>Hello, world!</body></html>"'
    from /Users/dczarnecki/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/json/common.rb:148:in `parse'
    from /Users/dczarnecki/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/json/common.rb:148:in `parse'
    from /Users/dczarnecki/.rvm/gems/ruby-1.9.3-p0@riak/gems/riak-client-0.9.8/lib/riak/robject.rb:222:in `deserialize'
    from /Users/dczarnecki/.rvm/gems/ruby-1.9.3-p0@riak/gems/riak-client-0.9.8/lib/riak/robject.rb:106:in `data'
    from /Users/dczarnecki/.rvm/gems/ruby-1.9.3-p0@riak/gems/riak-client-0.9.8/lib/riak/robject.rb:235:in `inspect'
    from /Users/dczarnecki/.rvm/rubies/ruby-1.9.3-p0/bin/irb:16:in `<main>'
seancribbs commented 12 years ago

Thanks, merged.