Skip to content

Instantly share code, notes, and snippets.

@will
Created February 28, 2009 09:50
Show Gist options
  • Save will/71929 to your computer and use it in GitHub Desktop.
Save will/71929 to your computer and use it in GitHub Desktop.
# so ugly, but it makes rails treat CouchRest::Documents correctly
class Hash
class << self
alias :old_trip_equal :===
def ===(other)
return false if other.class.ancestors.include?(CouchRest::Document)
old_trip_equal other
end
end
end
module CouchRest
class Document
alias :old_kind_of? :kind_of?
def kind_of?(o)
return false if o == Hash
old_kind_of?(o)
end
alias :old_is_a? :is_a?
def is_a?(o)
return false if o == Hash
old_is_a?(o)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment