Skip to content

Commit

Permalink
Do not use HashWithIndifferentAccess class unless it defined
Browse files Browse the repository at this point in the history
Change-Id: I703c5a3ed784eb8e2b1a1ca5d58c898951e1393d
Reviewed-on: http://review.couchbase.org/21773
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Reviewed-by: Matt Ingenthron <matt@couchbase.com>
  • Loading branch information
avsej committed Oct 22, 2012
1 parent 6d5797c commit 7d11648
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/couchbase/model.rb
Expand Up @@ -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)
Expand Down

0 comments on commit 7d11648

Please sign in to comment.