From 0c008d4bc75a5a0ecfbc5f313812cfd9d3400a25 Mon Sep 17 00:00:00 2001 From: Sam Lown Date: Mon, 21 Jun 2010 15:10:42 +0200 Subject: [PATCH] Renaming support delete method so as not to conflict with ExtendedDocument --- lib/couchrest/model/support/couchrest.rb | 4 +-- lib/couchrest/model/support/rails.rb | 32 ------------------------ 2 files changed, 2 insertions(+), 34 deletions(-) delete mode 100644 lib/couchrest/model/support/rails.rb diff --git a/lib/couchrest/model/support/couchrest.rb b/lib/couchrest/model/support/couchrest.rb index 6fde806..1d36894 100644 --- a/lib/couchrest/model/support/couchrest.rb +++ b/lib/couchrest/model/support/couchrest.rb @@ -3,10 +3,10 @@ module CouchRest class Database - alias :delete_old! :delete! + alias :delete_orig! :delete! def delete! clear_model_fresh_cache - delete_old! + delete_orig! end # If the database is deleted, ensure that the design docs will be refreshed. diff --git a/lib/couchrest/model/support/rails.rb b/lib/couchrest/model/support/rails.rb deleted file mode 100644 index f14d2da..0000000 --- a/lib/couchrest/model/support/rails.rb +++ /dev/null @@ -1,32 +0,0 @@ -# This file contains various hacks for Rails compatibility. -class Hash - # Hack so that CouchRest::Document, which descends from Hash, - # doesn't appear to Rails routing as a Hash of options - def self.===(other) - return false if self == Hash && other.is_a?(CouchRest::Document) - super - end -end - -CouchRest::Document.class_eval do - # Need this when passing doc to a resourceful route - alias_method :to_param, :id - - # Hack so that CouchRest::Document, which descends from Hash, - # doesn't appear to Rails routing as a Hash of options - def is_a?(o) - return false if o == Hash - super - end - alias_method :kind_of?, :is_a? -end - -CouchRest::Model::CastedModel.class_eval do - # The to_param method is needed for rails to generate resourceful routes. - # In your controller, remember that it's actually the id of the document. - def id - return nil if base_doc.nil? - base_doc.id - end - alias_method :to_param, :id -end