<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,52 +1,52 @@
 # This file contains various hacks for Rails compatibility.
-# To use, just require in environment.rb, like so:
-#
-#   require 'couchrest/support/rails'
 
-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 &amp;&amp; other.is_a?(CouchRest::Document)
-    super
-  end
-end
+if defined?(Rails)
 
+  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 &amp;&amp; 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
+  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?
+    # 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?
   
-  # Gives extended doc a seamless logger
-  def logger
-    ActiveRecord::Base.logger
+    # Gives extended doc a seamless logger
+    def logger
+      ActiveRecord::Base.logger
+    end
   end
-end
 
-CouchRest::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
+  CouchRest::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
-  alias_method :to_param, :id
-end
 
-require Pathname.new(File.dirname(__FILE__)).join('..', 'validation', 'validation_errors')
+  require Pathname.new(File.dirname(__FILE__)).join('..', 'validation', 'validation_errors')
 
-CouchRest::Validation::ValidationErrors.class_eval do
-  # Returns the total number of errors added. Two errors added to the same attribute will be counted as such.
-  # This method is called by error_messages_for
-  def count
-    errors.values.inject(0) { |error_count, errors_for_attribute| error_count + errors_for_attribute.size }
+  CouchRest::Validation::ValidationErrors.class_eval do
+    # Returns the total number of errors added. Two errors added to the same attribute will be counted as such.
+    # This method is called by error_messages_for
+    def count
+      errors.values.inject(0) { |error_count, errors_for_attribute| error_count + errors_for_attribute.size }
+    end
   end
+
 end</diff>
      <filename>lib/couchrest/support/rails.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>7246801f5781571783c1ed7e6c87bafac2adcfc0</id>
    </parent>
  </parents>
  <author>
    <name>Seth Ladd</name>
    <email>sladd@camber.com</email>
  </author>
  <url>http://github.com/will/couchrest/commit/36f69ec3324fdab8992cdfc964d11b32a253836d</url>
  <id>36f69ec3324fdab8992cdfc964d11b32a253836d</id>
  <committed-date>2009-06-08T14:48:15-07:00</committed-date>
  <authored-date>2009-06-08T14:48:15-07:00</authored-date>
  <message>check if Rails exists for the rails support</message>
  <tree>1bd9aba1c114e9c0bedfc1ef2a4678c8635c8ac6</tree>
  <committer>
    <name>Seth Ladd</name>
    <email>sladd@camber.com</email>
  </committer>
</commit>
