Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

remove pollution, thanks @ Tyler Rick

  • Loading branch information...
commit 6bf114068b858c146728aca226ac355dfee25418 1 parent eedc967
@grosser authored
View
1  Readme.md
@@ -76,6 +76,7 @@ Authors
### [Contributors](http://github.com/grosser/ar_after_transaction/contributors)
- [Bogdan Gusiev](http://gusiev.com)
- [Benedikt Deicke](http://blog.synatic.net)
+ - [Tyler Rick](https://github.com/TylerRick)
[Michael Grosser](http://grosser.it)<br/>
michael@grosser.it<br/>
View
1  gemfiles/rails2.gemfile
@@ -3,6 +3,7 @@
source :rubygems
gem "appraisal"
+gem "bump"
gem "rake"
gem "rspec", "~>2"
gem "sqlite3"
View
2  gemfiles/rails2.gemfile.lock
@@ -13,6 +13,7 @@ GEM
appraisal (0.4.1)
bundler
rake
+ bump (0.3.5)
diff-lcs (1.1.3)
rake (0.9.2.2)
rspec (2.11.0)
@@ -32,6 +33,7 @@ DEPENDENCIES
activerecord (~> 2.3.14)
appraisal
ar_after_transaction!
+ bump
rake
rspec (~> 2)
sqlite3
View
1  gemfiles/rails3.gemfile
@@ -3,6 +3,7 @@
source :rubygems
gem "appraisal"
+gem "bump"
gem "rake"
gem "rspec", "~>2"
gem "sqlite3"
View
2  gemfiles/rails3.gemfile.lock
@@ -23,6 +23,7 @@ GEM
rake
arel (3.0.2)
builder (3.0.4)
+ bump (0.3.5)
diff-lcs (1.1.3)
i18n (0.6.1)
multi_json (1.3.6)
@@ -45,6 +46,7 @@ DEPENDENCIES
activerecord (~> 3.2.7)
appraisal
ar_after_transaction!
+ bump
rake
rspec (~> 2)
sqlite3
View
13 lib/ar_after_transaction.rb
@@ -2,10 +2,6 @@
require 'ar_after_transaction/version'
module ARAfterTransaction
- def self.included(base)
- base.extend(ClassMethods)
- end
-
module ClassMethods
@@after_transaction_callbacks = []
@@ -51,9 +47,12 @@ def delete_after_transaction_callbacks
end
end
- def after_transaction(&block)
- self.class.after_transaction(&block)
+ module InstanceMethods
+ def after_transaction(&block)
+ self.class.after_transaction(&block)
+ end
end
end
-ActiveRecord::Base.send(:include, ARAfterTransaction)
+ActiveRecord::Base.send(:extend, ARAfterTransaction::ClassMethods)
+ActiveRecord::Base.send(:include, ARAfterTransaction::InstanceMethods)
View
7 spec/ar_after_transaction_spec.rb
@@ -119,3 +119,10 @@ def oops
end
end
end
+
+describe "A normal ActiveRecord subclass" do
+ it "does not get polluted" do
+ User.const_defined?(:VERSION).should be_false
+ User.const_defined?(:Version).should be_false
+ end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.