dirty_associations 0.4.1 → 0.4.2

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: 053ba80b3d4e3764f1aeea8fae54416b1561af28
4
- data.tar.gz: 61a8276db83af320e03f3c743aaf8d899ffe27c4
3
+ metadata.gz: 046bdd6028e751c1eb05042bd2e592bb56e6ea7d
4
+ data.tar.gz: 9a2d0d5a75467af5355f464e79823192adb4bd61
5
5
  SHA512:
6
- metadata.gz: f31875def37d4bad43200c00fbb965b0bbb0a0454cda57356c6366295fbed4e63fe7fc6f3432f2480337c1f2db6d18f6ae0fac014d2ee00c2d147921b71f6490
7
- data.tar.gz: fa9910330333548683423af9648efcf307d6a23695f9439aef579db8dc875d6a661a353183f96fb282123158de4832a5e40ae744a79a54293327d1c87d3b71cb
6
+ metadata.gz: e2ff66d8d3b18a90dc006bf8c8e3b8cf6ef3db0966f426800dc4fb265c4c42c2805945063c6884c0fe2b4033e47c6dc3cd2cde66981c7105bcec11b59ae0ddc7
7
+ data.tar.gz: 4f247e7bc2c217d9c9342025de69662b49d5c07197a023f29bbe77cdb242505a58e5a74af8b80516c60081acb11453548484fb45d51c68de7e9d658a4fccaf9d
@@ -25,6 +25,11 @@ module DirtyAssociations
25
25
  super(value)
26
26
  end
27
27
 
28
+ define_method "#{association}_attributes=" do |value|
29
+ attribute_will_change!(association.to_s)
30
+ super(value)
31
+ end
32
+
28
33
  [association, ids].each do |name|
29
34
  define_method "#{name}_change" do
30
35
  changes[name]
@@ -1,3 +1,3 @@
1
1
  module DirtyAssociations
2
- VERSION = "0.4.1"
2
+ VERSION = "0.4.2"
3
3
  end
@@ -48,6 +48,11 @@ class DirtyAssociationsTest < ActiveSupport::TestCase
48
48
  refute bar.foos_changed?
49
49
  end
50
50
 
51
+ test "setting has_many assocation attributes adds association to changes" do
52
+ bar.assign_attributes(:foos_attributes => [{}, {}])
53
+ assert bar.foos_changed?
54
+ end
55
+
51
56
  test "changes reset by save" do
52
57
  bar.foos = [ FactoryGirl.create(:foo) ]
53
58
  assert bar.foos_changed?
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dirty_associations
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jen Page
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-06 00:00:00.000000000 Z
11
+ date: 2014-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails