check if Rails exists for the rails support

This commit is contained in:
Seth Ladd 2009-06-08 11:48:15 -10:00
parent 7246801f57
commit 36f69ec332

View file

@ -1,7 +1,6 @@
# This file contains various hacks for Rails compatibility.
# To use, just require in environment.rb, like so:
#
# require 'couchrest/support/rails'
if defined?(Rails)
class Hash
# Hack so that CouchRest::Document, which descends from Hash,
@ -12,7 +11,6 @@ class Hash
end
end
CouchRest::Document.class_eval do
# Need this when passing doc to a resourceful route
alias_method :to_param, :id
@ -50,3 +48,5 @@ CouchRest::Validation::ValidationErrors.class_eval do
errors.values.inject(0) { |error_count, errors_for_attribute| error_count + errors_for_attribute.size }
end
end
end