acts_as 0.1.1 → 0.2.0
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 +4 -4
- data/lib/acts_as/version.rb +1 -1
- data/lib/acts_as.rb +7 -0
- data/spec/acts_as_spec.rb +9 -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: c7912bee92e4c32fc30f7ee224dad9d7b30db39c
|
4
|
+
data.tar.gz: b3e1764d00459b9cb8d0e49220f0f4fe73bae8af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 541b744acc4b81aadf1da41e8f3a965c769f1877f13f4dff5f081f50b02b5bdda5aefe0855424ef10112db1c1775a696bb8916a3023c6d0aff4e578623189321
|
7
|
+
data.tar.gz: c15b5e5c57411b02490cbf19e7b2ce8375a393798e91f1acac0f66272167368ce9fc95f5e7676b15e11b3bbf8485f7c77abc3f2d68b24062c64471a7552a6d58
|
data/lib/acts_as/version.rb
CHANGED
data/lib/acts_as.rb
CHANGED
@@ -10,6 +10,13 @@ module ActsAs
|
|
10
10
|
base.extend ClassMethods
|
11
11
|
end
|
12
12
|
|
13
|
+
def previous_changes
|
14
|
+
self.class.acts_as_fields.keys.map{ |association| send(association).previous_changes }
|
15
|
+
.reduce(super) do |current, association_changes|
|
16
|
+
current.merge(association_changes)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
13
20
|
private
|
14
21
|
|
15
22
|
def acts_as_field_match?(method)
|
data/spec/acts_as_spec.rb
CHANGED
@@ -82,4 +82,13 @@ describe ActsAs do
|
|
82
82
|
it { should respond_to(:cool?)}
|
83
83
|
specify { rebel.should_not be_cool }
|
84
84
|
end
|
85
|
+
|
86
|
+
describe '#previous_changes' do
|
87
|
+
it 'should account for acted models' do
|
88
|
+
rebel.strength = 12
|
89
|
+
rebel.name = 'bob'
|
90
|
+
rebel.save
|
91
|
+
rebel.previous_changes.should include('strength')
|
92
|
+
end
|
93
|
+
end
|
85
94
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acts_as
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- winfred
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-06-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|