after_commit_action 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +11 -2
- data/Gemfile.lock +133 -7
- data/VERSION +1 -1
- data/after_commit_action.gemspec +64 -11
- data/circle.yml +3 -0
- data/lib/after_commit_action.rb +15 -6
- data/spec/after_commit_action_spec.rb +16 -2
- data/spec/config/database.yml +3 -0
- data/spec/models/tester.rb +30 -0
- data/spec/rails_app/.gitignore +15 -0
- data/spec/rails_app/Gemfile +40 -0
- data/spec/rails_app/README.rdoc +261 -0
- data/spec/rails_app/Rakefile +7 -0
- data/spec/rails_app/app/assets/images/rails.png +0 -0
- data/spec/rails_app/app/assets/javascripts/application.js +15 -0
- data/spec/rails_app/app/assets/stylesheets/application.css +13 -0
- data/spec/rails_app/app/controllers/application_controller.rb +3 -0
- data/spec/rails_app/app/helpers/application_helper.rb +2 -0
- data/spec/rails_app/app/mailers/.gitkeep +0 -0
- data/spec/rails_app/app/models/.gitkeep +0 -0
- data/spec/rails_app/app/views/layouts/application.html.erb +14 -0
- data/spec/rails_app/config/application.rb +59 -0
- data/spec/rails_app/config/boot.rb +6 -0
- data/spec/rails_app/config/database.yml +25 -0
- data/spec/rails_app/config/environment.rb +5 -0
- data/spec/rails_app/config/environments/development.rb +37 -0
- data/spec/rails_app/config/environments/production.rb +67 -0
- data/spec/rails_app/config/environments/test.rb +37 -0
- data/spec/rails_app/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/rails_app/config/initializers/inflections.rb +15 -0
- data/spec/rails_app/config/initializers/mime_types.rb +5 -0
- data/spec/rails_app/config/initializers/secret_token.rb +7 -0
- data/spec/rails_app/config/initializers/session_store.rb +8 -0
- data/spec/rails_app/config/initializers/wrap_parameters.rb +14 -0
- data/spec/rails_app/config/locales/en.yml +5 -0
- data/spec/rails_app/config/routes.rb +58 -0
- data/spec/rails_app/config.ru +4 -0
- data/spec/rails_app/db/seeds.rb +7 -0
- data/spec/rails_app/lib/assets/.gitkeep +0 -0
- data/spec/rails_app/lib/tasks/.gitkeep +0 -0
- data/spec/rails_app/log/.gitkeep +0 -0
- data/spec/rails_app/public/404.html +26 -0
- data/spec/rails_app/public/422.html +26 -0
- data/spec/rails_app/public/500.html +25 -0
- data/spec/rails_app/public/favicon.ico +0 -0
- data/spec/rails_app/public/index.html +241 -0
- data/spec/rails_app/public/robots.txt +5 -0
- data/spec/rails_app/script/rails +6 -0
- data/spec/rails_app/test/fixtures/.gitkeep +0 -0
- data/spec/rails_app/test/functional/.gitkeep +0 -0
- data/spec/rails_app/test/integration/.gitkeep +0 -0
- data/spec/rails_app/test/performance/browsing_test.rb +12 -0
- data/spec/rails_app/test/test_helper.rb +13 -0
- data/spec/rails_app/test/unit/.gitkeep +0 -0
- data/spec/rails_app/vendor/assets/javascripts/.gitkeep +0 -0
- data/spec/rails_app/vendor/assets/stylesheets/.gitkeep +0 -0
- data/spec/rails_app/vendor/plugins/.gitkeep +0 -0
- data/spec/schema.rb +20 -0
- data/spec/spec_helper.rb +7 -1
- metadata +77 -40
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b4e82136b05236fe081e5cf4aa74c36b3d095dc6
|
4
|
+
data.tar.gz: 179b0cfdf191f0f7cc14a49288f3adba33c57431
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ad4a8e477a9b1292649c862aea39cbd44726fd820613543a58bbd4ccf3be64a82956d676bbcf9816e7c97ed576e4063c9b6ef8d08ff72953d5f55bc7abdf0040
|
7
|
+
data.tar.gz: b2bff1637b7b6e60d63bda7e2d7c713611c36dcceda44fa1579ec64a8bf889974b9f26a78ec789bf86bb1c068a120e3cb07c52953c6c08bd6bb60a99258dddc0
|
data/Gemfile
CHANGED
@@ -2,9 +2,18 @@ source "http://rubygems.org"
|
|
2
2
|
|
3
3
|
# Add dependencies to develop your gem here.
|
4
4
|
# Include everything needed to run rake, tests, features, etc.
|
5
|
+
group :development, :test do
|
6
|
+
gem "rails"
|
7
|
+
end
|
8
|
+
|
5
9
|
group :development do
|
6
|
-
gem "rspec", "~> 2.8.0"
|
7
10
|
gem "rdoc", "~> 3.12"
|
8
11
|
gem "bundler", ">= 1.1.3"
|
9
|
-
gem "jeweler", "~>
|
12
|
+
gem "jeweler", "~> 2.0.1"
|
13
|
+
end
|
14
|
+
|
15
|
+
group :test do
|
16
|
+
gem "rspec", "~> 2.8.0"
|
17
|
+
gem "sqlite3"
|
18
|
+
gem "rspec-extra-formatters"
|
10
19
|
end
|
data/Gemfile.lock
CHANGED
@@ -1,16 +1,123 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
+
actionmailer (4.2.0)
|
5
|
+
actionpack (= 4.2.0)
|
6
|
+
actionview (= 4.2.0)
|
7
|
+
activejob (= 4.2.0)
|
8
|
+
mail (~> 2.5, >= 2.5.4)
|
9
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
10
|
+
actionpack (4.2.0)
|
11
|
+
actionview (= 4.2.0)
|
12
|
+
activesupport (= 4.2.0)
|
13
|
+
rack (~> 1.6.0)
|
14
|
+
rack-test (~> 0.6.2)
|
15
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
16
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.1)
|
17
|
+
actionview (4.2.0)
|
18
|
+
activesupport (= 4.2.0)
|
19
|
+
builder (~> 3.1)
|
20
|
+
erubis (~> 2.7.0)
|
21
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
22
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.1)
|
23
|
+
activejob (4.2.0)
|
24
|
+
activesupport (= 4.2.0)
|
25
|
+
globalid (>= 0.3.0)
|
26
|
+
activemodel (4.2.0)
|
27
|
+
activesupport (= 4.2.0)
|
28
|
+
builder (~> 3.1)
|
29
|
+
activerecord (4.2.0)
|
30
|
+
activemodel (= 4.2.0)
|
31
|
+
activesupport (= 4.2.0)
|
32
|
+
arel (~> 6.0)
|
33
|
+
activesupport (4.2.0)
|
34
|
+
i18n (~> 0.7)
|
35
|
+
json (~> 1.7, >= 1.7.7)
|
36
|
+
minitest (~> 5.1)
|
37
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
38
|
+
tzinfo (~> 1.1)
|
39
|
+
addressable (2.3.6)
|
40
|
+
arel (6.0.0)
|
41
|
+
builder (3.2.2)
|
42
|
+
descendants_tracker (0.0.4)
|
43
|
+
thread_safe (~> 0.3, >= 0.3.1)
|
4
44
|
diff-lcs (1.1.3)
|
5
|
-
|
6
|
-
|
7
|
-
|
45
|
+
erubis (2.7.0)
|
46
|
+
faraday (0.9.0)
|
47
|
+
multipart-post (>= 1.2, < 3)
|
48
|
+
git (1.2.8)
|
49
|
+
github_api (0.12.2)
|
50
|
+
addressable (~> 2.3)
|
51
|
+
descendants_tracker (~> 0.0.4)
|
52
|
+
faraday (~> 0.8, < 0.10)
|
53
|
+
hashie (>= 3.3)
|
54
|
+
multi_json (>= 1.7.5, < 2.0)
|
55
|
+
nokogiri (~> 1.6.3)
|
56
|
+
oauth2
|
57
|
+
globalid (0.3.0)
|
58
|
+
activesupport (>= 4.1.0)
|
59
|
+
hashie (3.3.2)
|
60
|
+
highline (1.6.21)
|
61
|
+
hike (1.2.3)
|
62
|
+
i18n (0.7.0)
|
63
|
+
jeweler (2.0.1)
|
64
|
+
builder
|
65
|
+
bundler (>= 1.0)
|
8
66
|
git (>= 1.2.5)
|
67
|
+
github_api
|
68
|
+
highline (>= 1.6.15)
|
69
|
+
nokogiri (>= 1.5.10)
|
9
70
|
rake
|
10
71
|
rdoc
|
11
|
-
json (1.
|
12
|
-
|
13
|
-
|
72
|
+
json (1.8.1)
|
73
|
+
jwt (1.2.0)
|
74
|
+
loofah (2.0.1)
|
75
|
+
nokogiri (>= 1.5.9)
|
76
|
+
mail (2.6.3)
|
77
|
+
mime-types (>= 1.16, < 3)
|
78
|
+
mime-types (2.4.3)
|
79
|
+
mini_portile (0.6.1)
|
80
|
+
minitest (5.5.0)
|
81
|
+
multi_json (1.10.1)
|
82
|
+
multi_xml (0.5.5)
|
83
|
+
multipart-post (2.0.0)
|
84
|
+
nokogiri (1.6.5)
|
85
|
+
mini_portile (~> 0.6.0)
|
86
|
+
oauth2 (1.0.0)
|
87
|
+
faraday (>= 0.8, < 0.10)
|
88
|
+
jwt (~> 1.0)
|
89
|
+
multi_json (~> 1.3)
|
90
|
+
multi_xml (~> 0.5)
|
91
|
+
rack (~> 1.2)
|
92
|
+
rack (1.6.0)
|
93
|
+
rack-test (0.6.2)
|
94
|
+
rack (>= 1.0)
|
95
|
+
rails (4.2.0)
|
96
|
+
actionmailer (= 4.2.0)
|
97
|
+
actionpack (= 4.2.0)
|
98
|
+
actionview (= 4.2.0)
|
99
|
+
activejob (= 4.2.0)
|
100
|
+
activemodel (= 4.2.0)
|
101
|
+
activerecord (= 4.2.0)
|
102
|
+
activesupport (= 4.2.0)
|
103
|
+
bundler (>= 1.3.0, < 2.0)
|
104
|
+
railties (= 4.2.0)
|
105
|
+
sprockets-rails
|
106
|
+
rails-deprecated_sanitizer (1.0.3)
|
107
|
+
activesupport (>= 4.2.0.alpha)
|
108
|
+
rails-dom-testing (1.0.5)
|
109
|
+
activesupport (>= 4.2.0.beta, < 5.0)
|
110
|
+
nokogiri (~> 1.6.0)
|
111
|
+
rails-deprecated_sanitizer (>= 1.0.1)
|
112
|
+
rails-html-sanitizer (1.0.1)
|
113
|
+
loofah (~> 2.0)
|
114
|
+
railties (4.2.0)
|
115
|
+
actionpack (= 4.2.0)
|
116
|
+
activesupport (= 4.2.0)
|
117
|
+
rake (>= 0.8.7)
|
118
|
+
thor (>= 0.18.1, < 2.0)
|
119
|
+
rake (10.4.2)
|
120
|
+
rdoc (3.12.2)
|
14
121
|
json (~> 1.4)
|
15
122
|
rspec (2.8.0)
|
16
123
|
rspec-core (~> 2.8.0)
|
@@ -19,13 +126,32 @@ GEM
|
|
19
126
|
rspec-core (2.8.0)
|
20
127
|
rspec-expectations (2.8.0)
|
21
128
|
diff-lcs (~> 1.1.2)
|
129
|
+
rspec-extra-formatters (1.0.0)
|
22
130
|
rspec-mocks (2.8.0)
|
131
|
+
sprockets (2.12.3)
|
132
|
+
hike (~> 1.2)
|
133
|
+
multi_json (~> 1.0)
|
134
|
+
rack (~> 1.0)
|
135
|
+
tilt (~> 1.1, != 1.3.0)
|
136
|
+
sprockets-rails (2.2.2)
|
137
|
+
actionpack (>= 3.0)
|
138
|
+
activesupport (>= 3.0)
|
139
|
+
sprockets (>= 2.8, < 4.0)
|
140
|
+
sqlite3 (1.3.10)
|
141
|
+
thor (0.19.1)
|
142
|
+
thread_safe (0.3.4)
|
143
|
+
tilt (1.4.1)
|
144
|
+
tzinfo (1.2.2)
|
145
|
+
thread_safe (~> 0.1)
|
23
146
|
|
24
147
|
PLATFORMS
|
25
148
|
ruby
|
26
149
|
|
27
150
|
DEPENDENCIES
|
28
151
|
bundler (>= 1.1.3)
|
29
|
-
jeweler (~>
|
152
|
+
jeweler (~> 2.0.1)
|
153
|
+
rails
|
30
154
|
rdoc (~> 3.12)
|
31
155
|
rspec (~> 2.8.0)
|
156
|
+
rspec-extra-formatters
|
157
|
+
sqlite3
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.4
|
data/after_commit_action.gemspec
CHANGED
@@ -2,14 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
+
# stub: after_commit_action 0.1.4 ruby lib
|
5
6
|
|
6
7
|
Gem::Specification.new do |s|
|
7
8
|
s.name = "after_commit_action"
|
8
|
-
s.version = "0.1.
|
9
|
+
s.version = "0.1.4"
|
9
10
|
|
10
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
|
+
s.require_paths = ["lib"]
|
11
13
|
s.authors = ["BestVendor"]
|
12
|
-
s.date = "
|
14
|
+
s.date = "2014-12-25"
|
13
15
|
s.description = "Use this module to defer actions to the after-commit hook. This is useful if you want to trigger actions in after_create, after_destroy and after_update callbacks but want to execute them outside of the transaction (for example, to avoid deadlocks)."
|
14
16
|
s.email = "magnus@bestvendor.com"
|
15
17
|
s.extra_rdoc_files = [
|
@@ -27,37 +29,88 @@ Gem::Specification.new do |s|
|
|
27
29
|
"Rakefile",
|
28
30
|
"VERSION",
|
29
31
|
"after_commit_action.gemspec",
|
32
|
+
"circle.yml",
|
30
33
|
"lib/after_commit_action.rb",
|
31
34
|
"spec/after_commit_action_spec.rb",
|
35
|
+
"spec/config/database.yml",
|
36
|
+
"spec/models/tester.rb",
|
37
|
+
"spec/rails_app/.gitignore",
|
38
|
+
"spec/rails_app/Gemfile",
|
39
|
+
"spec/rails_app/README.rdoc",
|
40
|
+
"spec/rails_app/Rakefile",
|
41
|
+
"spec/rails_app/app/assets/images/rails.png",
|
42
|
+
"spec/rails_app/app/assets/javascripts/application.js",
|
43
|
+
"spec/rails_app/app/assets/stylesheets/application.css",
|
44
|
+
"spec/rails_app/app/controllers/application_controller.rb",
|
45
|
+
"spec/rails_app/app/helpers/application_helper.rb",
|
46
|
+
"spec/rails_app/app/mailers/.gitkeep",
|
47
|
+
"spec/rails_app/app/models/.gitkeep",
|
48
|
+
"spec/rails_app/app/views/layouts/application.html.erb",
|
49
|
+
"spec/rails_app/config.ru",
|
50
|
+
"spec/rails_app/config/application.rb",
|
51
|
+
"spec/rails_app/config/boot.rb",
|
52
|
+
"spec/rails_app/config/database.yml",
|
53
|
+
"spec/rails_app/config/environment.rb",
|
54
|
+
"spec/rails_app/config/environments/development.rb",
|
55
|
+
"spec/rails_app/config/environments/production.rb",
|
56
|
+
"spec/rails_app/config/environments/test.rb",
|
57
|
+
"spec/rails_app/config/initializers/backtrace_silencers.rb",
|
58
|
+
"spec/rails_app/config/initializers/inflections.rb",
|
59
|
+
"spec/rails_app/config/initializers/mime_types.rb",
|
60
|
+
"spec/rails_app/config/initializers/secret_token.rb",
|
61
|
+
"spec/rails_app/config/initializers/session_store.rb",
|
62
|
+
"spec/rails_app/config/initializers/wrap_parameters.rb",
|
63
|
+
"spec/rails_app/config/locales/en.yml",
|
64
|
+
"spec/rails_app/config/routes.rb",
|
65
|
+
"spec/rails_app/db/seeds.rb",
|
66
|
+
"spec/rails_app/lib/assets/.gitkeep",
|
67
|
+
"spec/rails_app/lib/tasks/.gitkeep",
|
68
|
+
"spec/rails_app/log/.gitkeep",
|
69
|
+
"spec/rails_app/public/404.html",
|
70
|
+
"spec/rails_app/public/422.html",
|
71
|
+
"spec/rails_app/public/500.html",
|
72
|
+
"spec/rails_app/public/favicon.ico",
|
73
|
+
"spec/rails_app/public/index.html",
|
74
|
+
"spec/rails_app/public/robots.txt",
|
75
|
+
"spec/rails_app/script/rails",
|
76
|
+
"spec/rails_app/test/fixtures/.gitkeep",
|
77
|
+
"spec/rails_app/test/functional/.gitkeep",
|
78
|
+
"spec/rails_app/test/integration/.gitkeep",
|
79
|
+
"spec/rails_app/test/performance/browsing_test.rb",
|
80
|
+
"spec/rails_app/test/test_helper.rb",
|
81
|
+
"spec/rails_app/test/unit/.gitkeep",
|
82
|
+
"spec/rails_app/vendor/assets/javascripts/.gitkeep",
|
83
|
+
"spec/rails_app/vendor/assets/stylesheets/.gitkeep",
|
84
|
+
"spec/rails_app/vendor/plugins/.gitkeep",
|
85
|
+
"spec/schema.rb",
|
32
86
|
"spec/spec_helper.rb"
|
33
87
|
]
|
34
88
|
s.homepage = "http://github.com/magnusvk/after_commit_action"
|
35
89
|
s.licenses = ["MIT"]
|
36
|
-
s.
|
37
|
-
s.rubygems_version = "1.8.21"
|
90
|
+
s.rubygems_version = "2.2.2"
|
38
91
|
s.summary = "Easily defer blocks of code to the after-commit action of an ActiveRecord model."
|
39
92
|
|
40
93
|
if s.respond_to? :specification_version then
|
41
|
-
s.specification_version =
|
94
|
+
s.specification_version = 4
|
42
95
|
|
43
96
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
44
|
-
s.add_development_dependency(%q<
|
97
|
+
s.add_development_dependency(%q<rails>, [">= 0"])
|
45
98
|
s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
|
46
99
|
s.add_development_dependency(%q<bundler>, [">= 1.1.3"])
|
47
|
-
s.add_development_dependency(%q<jeweler>, ["~>
|
100
|
+
s.add_development_dependency(%q<jeweler>, ["~> 2.0.1"])
|
48
101
|
s.add_runtime_dependency(%q<activerecord>, [">= 3.0.0"])
|
49
102
|
else
|
50
|
-
s.add_dependency(%q<
|
103
|
+
s.add_dependency(%q<rails>, [">= 0"])
|
51
104
|
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
52
105
|
s.add_dependency(%q<bundler>, [">= 1.1.3"])
|
53
|
-
s.add_dependency(%q<jeweler>, ["~>
|
106
|
+
s.add_dependency(%q<jeweler>, ["~> 2.0.1"])
|
54
107
|
s.add_dependency(%q<activerecord>, [">= 3.0.0"])
|
55
108
|
end
|
56
109
|
else
|
57
|
-
s.add_dependency(%q<
|
110
|
+
s.add_dependency(%q<rails>, [">= 0"])
|
58
111
|
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
59
112
|
s.add_dependency(%q<bundler>, [">= 1.1.3"])
|
60
|
-
s.add_dependency(%q<jeweler>, ["~>
|
113
|
+
s.add_dependency(%q<jeweler>, ["~> 2.0.1"])
|
61
114
|
s.add_dependency(%q<activerecord>, [">= 3.0.0"])
|
62
115
|
end
|
63
116
|
end
|
data/circle.yml
ADDED
data/lib/after_commit_action.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# use this module to defer actions to the after-commit hook. this is useful if you want
|
2
2
|
# to trigger actions in after_create, after_destroy and after_update callbacks but want
|
3
3
|
# to execute them outside of the transaction (for example, to avoid deadlocks).
|
4
|
-
#
|
4
|
+
#
|
5
5
|
# Usage:
|
6
6
|
# after_create :my_hook
|
7
7
|
# def my_hook
|
@@ -9,7 +9,7 @@
|
|
9
9
|
# end
|
10
10
|
|
11
11
|
module AfterCommitAction
|
12
|
-
|
12
|
+
|
13
13
|
module ActiveRecord
|
14
14
|
|
15
15
|
def self.included(base)
|
@@ -20,7 +20,7 @@ module AfterCommitAction
|
|
20
20
|
@_execute_after_commit ||= []
|
21
21
|
@_execute_after_commit<< block
|
22
22
|
end
|
23
|
-
|
23
|
+
|
24
24
|
def _after_commit_hook
|
25
25
|
begin
|
26
26
|
until @_execute_after_commit.blank?
|
@@ -38,9 +38,18 @@ module AfterCommitAction
|
|
38
38
|
raise e
|
39
39
|
end
|
40
40
|
end
|
41
|
-
|
41
|
+
|
42
42
|
end
|
43
43
|
|
44
|
-
|
45
|
-
|
44
|
+
if defined?(Rails) # if this is a full blown rails app, use a railtie. This avoids deprecation warnings in Rails 4.2
|
45
|
+
class Railtie < Rails::Railtie
|
46
|
+
initializer "active_record.include_plugins" do
|
47
|
+
ActiveSupport.on_load(:active_record) do
|
48
|
+
::ActiveRecord::Base.send :include, ActiveRecord
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
else
|
53
|
+
::ActiveRecord::Base.send :include, ActiveRecord
|
54
|
+
end
|
46
55
|
end
|
@@ -1,7 +1,21 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
2
|
|
3
|
+
require 'models/tester'
|
4
|
+
|
3
5
|
describe "AfterCommitAction" do
|
4
|
-
it "
|
5
|
-
|
6
|
+
it "should correctly execute tasks after commit" do
|
7
|
+
t = Tester.new
|
8
|
+
t.array.should be_empty
|
9
|
+
t.save!
|
10
|
+
t.array.size.should == 2
|
11
|
+
t.array.should include('before_create')
|
12
|
+
t.array.should include('after_create')
|
13
|
+
|
14
|
+
t = Tester.first
|
15
|
+
t.array.should be_empty
|
16
|
+
t.save!
|
17
|
+
t.array.size.should == 2
|
18
|
+
t.array.should include('before_update')
|
19
|
+
t.array.should include('after_update')
|
6
20
|
end
|
7
21
|
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
class Tester < ActiveRecord::Base
|
2
|
+
after_initialize :after_initialize
|
3
|
+
|
4
|
+
before_create :before_create
|
5
|
+
after_create :after_create
|
6
|
+
before_update :before_update
|
7
|
+
after_update :after_update
|
8
|
+
|
9
|
+
attr_reader :array
|
10
|
+
|
11
|
+
def after_initialize
|
12
|
+
@array = []
|
13
|
+
end
|
14
|
+
|
15
|
+
def before_create
|
16
|
+
execute_after_commit { @array<< 'before_create' }
|
17
|
+
end
|
18
|
+
|
19
|
+
def after_create
|
20
|
+
execute_after_commit { @array<< 'after_create' }
|
21
|
+
end
|
22
|
+
|
23
|
+
def before_update
|
24
|
+
execute_after_commit { @array<< 'before_update' }
|
25
|
+
end
|
26
|
+
|
27
|
+
def after_update
|
28
|
+
execute_after_commit { @array<< 'after_update' }
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# See http://help.github.com/ignore-files/ for more about ignoring files.
|
2
|
+
#
|
3
|
+
# If you find yourself ignoring temporary files generated by your text editor
|
4
|
+
# or operating system, you probably want to add a global ignore instead:
|
5
|
+
# git config --global core.excludesfile ~/.gitignore_global
|
6
|
+
|
7
|
+
# Ignore bundler config
|
8
|
+
/.bundle
|
9
|
+
|
10
|
+
# Ignore the default SQLite database.
|
11
|
+
/db/*.sqlite3
|
12
|
+
|
13
|
+
# Ignore all logfiles and tempfiles.
|
14
|
+
/log/*.log
|
15
|
+
/tmp
|
@@ -0,0 +1,40 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
gem 'rails', '3.2.3'
|
4
|
+
|
5
|
+
# Bundle edge Rails instead:
|
6
|
+
# gem 'rails', :git => 'git://github.com/rails/rails.git'
|
7
|
+
|
8
|
+
gem 'sqlite3'
|
9
|
+
|
10
|
+
|
11
|
+
# Gems used only for assets and not required
|
12
|
+
# in production environments by default.
|
13
|
+
group :assets do
|
14
|
+
gem 'sass-rails', '~> 3.2.3'
|
15
|
+
gem 'coffee-rails', '~> 3.2.1'
|
16
|
+
|
17
|
+
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
|
18
|
+
# gem 'therubyracer', :platform => :ruby
|
19
|
+
|
20
|
+
gem 'uglifier', '>= 1.0.3'
|
21
|
+
end
|
22
|
+
|
23
|
+
gem 'jquery-rails'
|
24
|
+
|
25
|
+
gem 'after_commit_action', path: "../"
|
26
|
+
|
27
|
+
# To use ActiveModel has_secure_password
|
28
|
+
# gem 'bcrypt-ruby', '~> 3.0.0'
|
29
|
+
|
30
|
+
# To use Jbuilder templates for JSON
|
31
|
+
# gem 'jbuilder'
|
32
|
+
|
33
|
+
# Use unicorn as the app server
|
34
|
+
# gem 'unicorn'
|
35
|
+
|
36
|
+
# Deploy with Capistrano
|
37
|
+
# gem 'capistrano'
|
38
|
+
|
39
|
+
# To use debugger
|
40
|
+
# gem 'ruby-debug19', :require => 'ruby-debug'
|