association_callbacks 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a24c4d966287e02167d053db7ac3d614f25c526d
4
- data.tar.gz: a930bcc6ac2d737d0377b8e4703a4a34633617a6
3
+ metadata.gz: b84fac371113053eced3e44f52f6637f7b3d3e2c
4
+ data.tar.gz: f4618ff625fc0e37557c2ce5c4e7161b1eb42a26
5
5
  SHA512:
6
- metadata.gz: cedc735e10a46f10dd9c2e344a7286fcfe55984bfdca5df5f42d093681056b46a3e3237359257d9fa7af0433b9a2e07b40642f2438cedfa9cce8d1d731e6bbb6
7
- data.tar.gz: 5c6de3ccf17235ab514f11be5e89b79120cead82dd8abb727855f34699b0f6a5111ed9039cbacfc291641aad72f704b985f416578ab02b5c5b99e44e6746f725
6
+ metadata.gz: 59bc2f83e567d57eeaed86883d0e3e64746c2a34e842353b13060022e4160bcaf5653b9b5f3a4be6364c561a4eacdcadf8c69e7ac6f9569d5e10a103d94eecae
7
+ data.tar.gz: 89000226c75832ce4daacca681c826cc3425d4358c26af5eb7fc27aa130e8adb8b935f6937eb4b44e4cb76e9c02db1861f9e3f79943004f2c77c5a293ed72705
data/Gemfile CHANGED
@@ -1,3 +1,3 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gemspec
3
+ gemspec
data/Gemfile.lock CHANGED
@@ -1,56 +1,53 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- association_callbacks (0.2.0)
5
- activerecord (~> 4.0.0)
6
- activesupport (~> 4.0.0)
4
+ association_callbacks (0.2.1)
5
+ activerecord (~> 4.1.0)
6
+ activesupport (~> 4.1.0)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- activemodel (4.0.0)
12
- activesupport (= 4.0.0)
13
- builder (~> 3.1.0)
14
- activerecord (4.0.0)
15
- activemodel (= 4.0.0)
16
- activerecord-deprecated_finders (~> 1.0.2)
17
- activesupport (= 4.0.0)
18
- arel (~> 4.0.0)
19
- activerecord-deprecated_finders (1.0.3)
20
- activesupport (4.0.0)
21
- i18n (~> 0.6, >= 0.6.4)
22
- minitest (~> 4.2)
23
- multi_json (~> 1.3)
11
+ activemodel (4.1.1)
12
+ activesupport (= 4.1.1)
13
+ builder (~> 3.1)
14
+ activerecord (4.1.1)
15
+ activemodel (= 4.1.1)
16
+ activesupport (= 4.1.1)
17
+ arel (~> 5.0.0)
18
+ activesupport (4.1.1)
19
+ i18n (~> 0.6, >= 0.6.9)
20
+ json (~> 1.7, >= 1.7.7)
21
+ minitest (~> 5.1)
24
22
  thread_safe (~> 0.1)
25
- tzinfo (~> 0.3.37)
26
- arel (4.0.0)
27
- atomic (1.1.10)
28
- builder (3.1.4)
29
- diff-lcs (1.2.4)
30
- i18n (0.6.4)
31
- minitest (4.7.5)
32
- multi_json (1.7.7)
33
- rake (10.1.0)
23
+ tzinfo (~> 1.1)
24
+ arel (5.0.1.20140414130214)
25
+ builder (3.2.2)
26
+ diff-lcs (1.2.5)
27
+ i18n (0.6.9)
28
+ json (1.8.1)
29
+ minitest (5.3.3)
30
+ rake (10.3.1)
34
31
  rspec (2.14.1)
35
32
  rspec-core (~> 2.14.0)
36
33
  rspec-expectations (~> 2.14.0)
37
34
  rspec-mocks (~> 2.14.0)
38
- rspec-core (2.14.3)
39
- rspec-expectations (2.14.0)
35
+ rspec-core (2.14.8)
36
+ rspec-expectations (2.14.5)
40
37
  diff-lcs (>= 1.1.3, < 2.0)
41
- rspec-mocks (2.14.1)
42
- sqlite3 (1.3.7)
38
+ rspec-mocks (2.14.6)
39
+ sqlite3 (1.3.9)
43
40
  sqlite3-ruby (1.3.3)
44
41
  sqlite3 (>= 1.3.3)
45
- thread_safe (0.1.0)
46
- atomic
47
- tzinfo (0.3.37)
42
+ thread_safe (0.3.3)
43
+ tzinfo (1.1.0)
44
+ thread_safe (~> 0.1)
48
45
 
49
46
  PLATFORMS
50
47
  ruby
51
48
 
52
49
  DEPENDENCIES
53
50
  association_callbacks!
54
- rake (~> 10.1.0)
51
+ rake (~> 10.3.0)
55
52
  rspec (~> 2.14.0)
56
53
  sqlite3-ruby (~> 1.3.0)
data/README.mdown CHANGED
@@ -11,7 +11,7 @@ First, two simple `Article` and `Comment` models:
11
11
  class Article < ActiveRecord::Base
12
12
  has_many :comments
13
13
  end
14
-
14
+
15
15
  class Comment < ActiveRecord::Base
16
16
  belongs_to :article
17
17
  end
@@ -21,10 +21,10 @@ Here is the standard way to denormalize `last_comment_at` on posts:
21
21
 
22
22
  class Comment < ActiveRecord::Base
23
23
  belongs_to :article
24
-
24
+
25
25
  after_create :update_post_last_comment_at
26
26
  after_destroy :update_post_last_comment_at
27
-
27
+
28
28
  def update_post_last_comment_at
29
29
  post.update_attributes!(last_comment_at: post.comments.order('created_at').last.try(:created_at))
30
30
  end
@@ -39,10 +39,10 @@ Here is how to do it with `association_callabacks`:
39
39
 
40
40
  class Post < ActiveRecord::Base
41
41
  has_many :comments
42
-
42
+
43
43
  after_create :update_last_comment_at, source: :comments
44
44
  after_destroy :update_last_comment_at, source: :comments
45
-
45
+
46
46
  def update_last_comment_at
47
47
  update_attributes!(last_comment_at: comments.order('created_at').last.try(:created_at))
48
48
  end
@@ -56,9 +56,9 @@ argument, above code can be:
56
56
 
57
57
  class Post < ActiveRecord::Base
58
58
  has_many :comments
59
-
59
+
60
60
  after_create :update_last_comment_at
61
-
61
+
62
62
  def update_last_comment_at(comment)
63
63
  update_attributes!(last_comment_at: comment.created_at)
64
64
  end
@@ -68,7 +68,7 @@ Association callbacks can also be defined as block:
68
68
 
69
69
  class Post < ActiveRecord::Base
70
70
  has_many :comments
71
-
71
+
72
72
  after_destroy source: :comments do |post|
73
73
  post.decrement!(:comments_count)
74
74
  end
@@ -90,4 +90,4 @@ Then, just run `bundle install`.
90
90
  ## Executing test suite
91
91
 
92
92
  This project is fully tested with [Rspec 2](http://github.com/rspec/rspec).
93
- Just run `bundle exec rake` (after a `bundle install`).
93
+ Just run `bundle exec rake` (after a `bundle install`).
data/Rakefile CHANGED
@@ -7,4 +7,4 @@ desc 'Default: runs specs.'
7
7
  task default: :spec
8
8
 
9
9
  desc 'Run all specs in spec directory.'
10
- RSpec::Core::RakeTask.new(:spec)
10
+ RSpec::Core::RakeTask.new(:spec)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.2.1
@@ -16,10 +16,10 @@ Gem::Specification.new do |s|
16
16
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
17
17
  s.require_paths = ['lib']
18
18
 
19
- s.add_dependency 'activerecord', '~> 4.0.0'
20
- s.add_dependency 'activesupport', '~> 4.0.0'
19
+ s.add_dependency 'activerecord', '~> 4.1.0'
20
+ s.add_dependency 'activesupport', '~> 4.1.0'
21
21
 
22
- s.add_development_dependency 'rake', '~> 10.1.0'
22
+ s.add_development_dependency 'rake', '~> 10.3.0'
23
23
  s.add_development_dependency 'rspec', '~> 2.14.0'
24
24
  s.add_development_dependency 'sqlite3-ruby', '~> 1.3.0'
25
25
  end
@@ -15,4 +15,4 @@ lib_path = "#{__dir__}/association_callbacks"
15
15
 
16
16
  require "#{lib_path}/active_record"
17
17
 
18
- ActiveRecord::Base.send(:include, AssociationCallbacks::ActiveRecord)
18
+ ActiveRecord::Base.send(:include, AssociationCallbacks::ActiveRecord)
@@ -86,4 +86,4 @@ module AssociationCallbacks
86
86
 
87
87
  end
88
88
 
89
- end
89
+ end
@@ -23,4 +23,4 @@ class Comment < ActiveRecord::Base
23
23
  update_attributes!(post_updated_at: post.updated_at)
24
24
  end
25
25
 
26
- end
26
+ end
data/spec/mocks/post.rb CHANGED
@@ -20,4 +20,4 @@ class Post < ActiveRecord::Base
20
20
  update_attributes!(last_comment_at: comment.created_at)
21
21
  end
22
22
 
23
- end
23
+ end
data/spec/spec_helper.rb CHANGED
@@ -13,4 +13,4 @@ RSpec.configure do |config|
13
13
  Comment.delete_all
14
14
  Post.delete_all
15
15
  end
16
- end
16
+ end
@@ -14,4 +14,4 @@ ActiveRecord::Base.connection.create_table(:posts, force: true) do |t|
14
14
  t.text :texts
15
15
  t.string :title
16
16
  t.timestamps
17
- end
17
+ end
metadata CHANGED
@@ -1,83 +1,83 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: association_callbacks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexis Toulotte
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-18 00:00:00.000000000 Z
11
+ date: 2014-05-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 4.0.0
19
+ version: 4.1.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 4.0.0
26
+ version: 4.1.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activesupport
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 4.0.0
33
+ version: 4.1.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 4.0.0
40
+ version: 4.1.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 10.1.0
47
+ version: 10.3.0
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 10.1.0
54
+ version: 10.3.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: 2.14.0
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ~>
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: 2.14.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: sqlite3-ruby
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ~>
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
75
  version: 1.3.0
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ~>
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: 1.3.0
83
83
  description: Provides a way to define callbacks of one ActiveRecord model into an
@@ -87,8 +87,8 @@ executables: []
87
87
  extensions: []
88
88
  extra_rdoc_files: []
89
89
  files:
90
- - .gitignore
91
- - .rspec
90
+ - ".gitignore"
91
+ - ".rspec"
92
92
  - Gemfile
93
93
  - Gemfile.lock
94
94
  - MIT-LICENSE
@@ -114,17 +114,17 @@ require_paths:
114
114
  - lib
115
115
  required_ruby_version: !ruby/object:Gem::Requirement
116
116
  requirements:
117
- - - '>='
117
+ - - ">="
118
118
  - !ruby/object:Gem::Version
119
119
  version: '0'
120
120
  required_rubygems_version: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - '>='
122
+ - - ">="
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  requirements: []
126
126
  rubyforge_project: association_callbacks
127
- rubygems_version: 2.0.3
127
+ rubygems_version: 2.2.2
128
128
  signing_key:
129
129
  specification_version: 4
130
130
  summary: Callbacks for ActiveRecord associations