callback_skipper 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +4 -0
- data/lib/callback_skipper/version.rb +1 -1
- data/lib/callback_skipper.rb +4 -6
- metadata +9 -9
data/README.md
CHANGED
@@ -8,7 +8,10 @@ Programatically Skip ActiveRecord Callbacks
|
|
8
8
|
|
9
9
|
## Installation
|
10
10
|
|
11
|
+
```ruby
|
12
|
+
# Gemfile
|
11
13
|
gem 'callback_skipper'
|
14
|
+
```
|
12
15
|
|
13
16
|
## Usage
|
14
17
|
|
@@ -24,6 +27,7 @@ foo.save!
|
|
24
27
|
### Example: FactoryGirl Usage
|
25
28
|
|
26
29
|
https://github.com/thoughtbot/factory_girl
|
30
|
+
|
27
31
|
```ruby
|
28
32
|
# spec/factories/foo_factory.rb
|
29
33
|
Factory.define :foo do |f|
|
data/lib/callback_skipper.rb
CHANGED
@@ -2,12 +2,10 @@ require "callback_skipper/version"
|
|
2
2
|
|
3
3
|
module CallbackSkipper
|
4
4
|
extend ActiveSupport::Concern
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
self.class.skip_callback *args
|
10
|
-
end
|
5
|
+
def skip_callback(*args)
|
6
|
+
instance = self
|
7
|
+
args << {:if => lambda { self == instance }}
|
8
|
+
self.class.skip_callback *args
|
11
9
|
end
|
12
10
|
end
|
13
11
|
ActiveRecord::Base.send :include, CallbackSkipper
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: callback_skipper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 1
|
10
|
+
version: 0.3.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ryan Sonnek
|
@@ -15,11 +15,9 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2012-01-24 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
|
-
name: activerecord
|
22
|
-
prerelease: false
|
23
21
|
version_requirements: &id001 !ruby/object:Gem::Requirement
|
24
22
|
none: false
|
25
23
|
requirements:
|
@@ -31,10 +29,10 @@ dependencies:
|
|
31
29
|
- 0
|
32
30
|
version: "3.0"
|
33
31
|
requirement: *id001
|
32
|
+
prerelease: false
|
33
|
+
name: activerecord
|
34
34
|
type: :runtime
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
|
-
name: rake
|
37
|
-
prerelease: false
|
38
36
|
version_requirements: &id002 !ruby/object:Gem::Requirement
|
39
37
|
none: false
|
40
38
|
requirements:
|
@@ -48,6 +46,8 @@ dependencies:
|
|
48
46
|
- 2
|
49
47
|
version: 0.9.2.2
|
50
48
|
requirement: *id002
|
49
|
+
prerelease: false
|
50
|
+
name: rake
|
51
51
|
type: :development
|
52
52
|
description: programatically skip ActiveRecord callbacks
|
53
53
|
email:
|
@@ -98,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
98
98
|
requirements: []
|
99
99
|
|
100
100
|
rubyforge_project: callback_skipper
|
101
|
-
rubygems_version: 1.8.
|
101
|
+
rubygems_version: 1.8.10
|
102
102
|
signing_key:
|
103
103
|
specification_version: 3
|
104
104
|
summary: Skip ActiveRecord callbacks
|