[RCBC-71] Calling incorrect methods on MultiJson when format is :document causing Couchbase::Error::ValueFormat Created: 16/Aug/12  Updated: 13/Nov/12  Resolved: 19/Oct/12

Status: Closed
Project: Couchbase Ruby client library
Component/s: library
Affects Version/s: 1.2.0.dp6
Fix Version/s: None
Security Level: Public

Type: Bug Priority: Major
Reporter: Chris McGrath Assignee: Sergey Avseyev
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

The C code calls dump/load on MultiJson, but its interface is encode/decode. Adding the following hack allows me to .set when the format is :document.

module MultiJson
  class << self
    alias_method :dump, :encode
    alias_method :load, :decode

Comment by Sergey Avseyev [ 17/Aug/12 ]
What multi-json version are you using? There is fix for that already included. I guess it doesn't meet condition for you. Could you please check it? https://github.com/couchbase/couchbase-ruby-client/blob/master/lib/ext/multi_json_fix.rb#L40-L47
Comment by Sergey Avseyev [ 17/Aug/12 ]
I see typo there

 MultiJson.respond_to?(:encode) && MultiJson.respond_to?(:encode)

But I don't think it cause the issue
Comment by Sergey Avseyev [ 19/Oct/12 ]
Generated at Tue Sep 23 17:09:18 CDT 2014 using JIRA 5.2.4#845-sha1:c9f4cc41abe72fb236945343a1f485c2c844dac9.