Created
December 22, 2008 21:32
-
-
Save Roman2K/39131 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 3014a599a158c7ef1332bf3dbc6ca25c015c618e Mon Sep 17 00:00:00 2001 | |
From: Roman Le Negrate <[email protected]> | |
Date: Mon, 22 Dec 2008 22:30:20 +0100 | |
Subject: [PATCH] only include acts-like-git specific modules when versioning gets configured | |
--- | |
lib/acts_like_git.rb | 7 +------ | |
lib/acts_like_git/active_record_ext/base.rb | 4 ++++ | |
2 files changed, 5 insertions(+), 6 deletions(-) | |
diff --git a/lib/acts_like_git.rb b/lib/acts_like_git.rb | |
index 7ead5a1..647e125 100644 | |
--- a/lib/acts_like_git.rb | |
+++ b/lib/acts_like_git.rb | |
@@ -42,9 +42,4 @@ module ActsLikeGit | |
autoload :ModelInit, 'acts_like_git/model_init' | |
end | |
-ActiveRecord::Base.class_eval do | |
- extend ActsLikeGit::ActiveRecordExt::Base | |
- include ActsLikeGit::ActiveRecordExt::Callbacks | |
- include ActsLikeGit::ActiveRecordExt::Git | |
- include ActsLikeGit::ActiveRecordExt::VersionMethods | |
-end | |
+ActiveRecord::Base.extend ActsLikeGit::ActiveRecordExt::Base | |
diff --git a/lib/acts_like_git/active_record_ext/base.rb b/lib/acts_like_git/active_record_ext/base.rb | |
index 407f482..b12ee53 100644 | |
--- a/lib/acts_like_git/active_record_ext/base.rb | |
+++ b/lib/acts_like_git/active_record_ext/base.rb | |
@@ -20,6 +20,10 @@ module ActsLikeGit | |
def versioning(*fields, &block) | |
return unless ActsLikeGit.versioning_enabled? | |
+ include ActsLikeGit::ActiveRecordExt::Callbacks | |
+ include ActsLikeGit::ActiveRecordExt::Git | |
+ include ActsLikeGit::ActiveRecordExt::VersionMethods | |
+ | |
ActsLikeGit.all_versioned_models |= [self.name] if ActsLikeGit.all_versioned_models | |
self.git_settings ||= ModelInit.new(self, &block) | |
-- | |
1.6.0.4 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment