From 7d1164884d314b993fd7bf4950c4a533f10c5ed3 Mon Sep 17 00:00:00 2001 From: Sergey Avseyev Date: Fri, 19 Oct 2012 14:53:15 +0300 Subject: [PATCH] Do not use HashWithIndifferentAccess class unless it defined Change-Id: I703c5a3ed784eb8e2b1a1ca5d58c898951e1393d Reviewed-on: http://review.couchbase.org/21773 Tested-by: Sergey Avseyev Reviewed-by: Matt Ingenthron --- lib/couchbase/model.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/couchbase/model.rb b/lib/couchbase/model.rb index bbbbdc3..a477152 100644 --- a/lib/couchbase/model.rb +++ b/lib/couchbase/model.rb @@ -425,8 +425,8 @@ def self.create(*args) def initialize(attrs = {}) @errors = ::ActiveModel::Errors.new(self) if defined?(::ActiveModel) case attrs - when Hash, HashWithIndifferentAccess - if attrs.respond_to?(:with_indifferent_access) + when Hash + if defined?(HashWithIndifferentAccess) && !attrs.is_a?(HashWithIndifferentAccess) attrs = attrs.with_indifferent_access end @id = attrs.delete(:id)