dirty_associations 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dirty_associations.rb +5 -0
- data/lib/dirty_associations/version.rb +1 -1
- data/test/dirty_associations_test.rb +5 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 046bdd6028e751c1eb05042bd2e592bb56e6ea7d
|
4
|
+
data.tar.gz: 9a2d0d5a75467af5355f464e79823192adb4bd61
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e2ff66d8d3b18a90dc006bf8c8e3b8cf6ef3db0966f426800dc4fb265c4c42c2805945063c6884c0fe2b4033e47c6dc3cd2cde66981c7105bcec11b59ae0ddc7
|
7
|
+
data.tar.gz: 4f247e7bc2c217d9c9342025de69662b49d5c07197a023f29bbe77cdb242505a58e5a74af8b80516c60081acb11453548484fb45d51c68de7e9d658a4fccaf9d
|
data/lib/dirty_associations.rb
CHANGED
@@ -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]
|
@@ -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.
|
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-
|
11
|
+
date: 2014-10-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|