From a6ed39705d1f574c6702944127c31e0134abed22 Mon Sep 17 00:00:00 2001 From: Mathias Meyer Date: Tue, 4 May 2010 17:31:24 +0800 Subject: [PATCH] Removed requirement for validatable gem. Allows for using more uptodate versions of the library, or doesn't install it when you're using ActiveModel. --- Rakefile | 1 - lib/couch_potato/validation/with_validatable.rb | 7 ++++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Rakefile b/Rakefile index 15f6482f..9857808d 100644 --- a/Rakefile +++ b/Rakefile @@ -90,7 +90,6 @@ begin s.authors = ["Alexander Lang"] s.files = FileList["[A-Z]*.*", "{lib,spec,rails}/**/*", "init.rb"] s.add_dependency 'json' - s.add_dependency 'validatable' s.add_dependency 'couchrest', '>=0.24' end rescue LoadError diff --git a/lib/couch_potato/validation/with_validatable.rb b/lib/couch_potato/validation/with_validatable.rb index 158d2650..62a448ce 100644 --- a/lib/couch_potato/validation/with_validatable.rb +++ b/lib/couch_potato/validation/with_validatable.rb @@ -2,7 +2,12 @@ module CouchPotato module Validation module WithValidatable def self.included(base) - require 'validatable' + begin + require 'validatable' + rescue LoadError + puts "Please install the gem validatable using 'gem install validatable'" + raise + end base.send :include, ::Validatable base.class_eval do # Override the validate method to first run before_validation callback