secretary-rails 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +1 -1
- data/lib/generators/secretary/install_generator.rb +1 -1
- data/lib/secretary/dirty_associations.rb +4 -3
- data/lib/secretary/dirty_associations/collection.rb +4 -4
- data/lib/secretary/gem_version.rb +1 -1
- data/spec/internal/app/models/person.rb +2 -2
- data/spec/lib/generators/secretary/install_generator_spec.rb +1 -2
- metadata +83 -55
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 0a8cfcd226bf38187864ede02d2be70348ca2f70
|
4
|
+
data.tar.gz: 4d0c9b74fd657334bdd7148d589f00e1cfab1b85
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 32482a0cc1bea10673c6aff238f502cb46bfbcaa8ecde100a34e3739e2194c6d7726f1fd7610ff406787c8e4d04fbfcf0044355febd4d9acd7901af8d604d03e
|
7
|
+
data.tar.gz: 7c52c5896c46cdad6253a8cc9bee1ae1f440a20c4229f4ab3f7771bc242de4bd775b5bfdeef9d9876eaf66b44250a0d3ade28c67c29d58503cd1d9efcf1b7e44
|
data/README.md
CHANGED
@@ -17,7 +17,7 @@ module Secretary
|
|
17
17
|
source_root File.expand_path("../templates", __FILE__)
|
18
18
|
|
19
19
|
def copy_migration
|
20
|
-
migration_template "versions_migration.rb", "db/migrate/secretary_create_versions"
|
20
|
+
migration_template "versions_migration.rb", "db/migrate/secretary_create_versions.rb"
|
21
21
|
end
|
22
22
|
|
23
23
|
def copy_config
|
@@ -57,9 +57,10 @@ module Secretary
|
|
57
57
|
EOE
|
58
58
|
end
|
59
59
|
|
60
|
-
def add_callback_methods(
|
61
|
-
|
62
|
-
reflection.options[
|
60
|
+
def add_callback_methods(cb_name, reflection, new_methods)
|
61
|
+
# The callbacks may not be an Array, so we'll force them into one.
|
62
|
+
reflection.options[cb_name] = Array(reflection.options[cb_name])
|
63
|
+
reflection.options[cb_name] += new_methods
|
63
64
|
end
|
64
65
|
|
65
66
|
# Necessary for Rails < 4.1
|
@@ -8,13 +8,13 @@ module Secretary
|
|
8
8
|
|
9
9
|
def add_collection_callbacks(name, reflection)
|
10
10
|
add_callback_methods(:before_add, reflection,
|
11
|
-
[:
|
11
|
+
[:prepare_to_change_association])
|
12
12
|
|
13
13
|
add_callback_methods(:before_remove, reflection,
|
14
|
-
[:
|
14
|
+
[:prepare_to_change_association])
|
15
15
|
|
16
16
|
if ActiveRecord::VERSION::STRING >= "4.1.0"
|
17
|
-
ActiveRecord::Associations::Builder::
|
17
|
+
ActiveRecord::Associations::Builder::HasMany
|
18
18
|
.define_callbacks(self, reflection)
|
19
19
|
else
|
20
20
|
redefine_callback(:before_add, name, reflection)
|
@@ -28,7 +28,7 @@ module Secretary
|
|
28
28
|
|
29
29
|
|
30
30
|
# If the record wasn't changed, we need to reset the changed_attributes.
|
31
|
-
# If there were previous changes, then reset the changes to the last
|
31
|
+
# If there were previous changes, then reset the changes to the last
|
32
32
|
# ones. Otherwise, just delete that empty key/value from the hash.
|
33
33
|
def reset_changes_if_unchanged(record, name, previous)
|
34
34
|
if record.versioned_changes.empty?
|
@@ -2,8 +2,8 @@ class Person < ActiveRecord::Base
|
|
2
2
|
has_secretary :except => ["name", "ethnicity"]
|
3
3
|
|
4
4
|
belongs_to :location
|
5
|
-
has_many :animals
|
6
|
-
has_many :hobbies
|
5
|
+
has_many :animals, dependent: :destroy
|
6
|
+
has_many :hobbies, dependent: :destroy
|
7
7
|
|
8
8
|
accepts_nested_attributes_for :animals, :allow_destroy => true
|
9
9
|
tracks_association :animals, :hobbies
|
@@ -12,11 +12,10 @@ describe Secretary::InstallGenerator do
|
|
12
12
|
end
|
13
13
|
|
14
14
|
it 'copies the migration file' do
|
15
|
-
assert_migration "db/migrate/secretary_create_versions"
|
15
|
+
assert_migration "db/migrate/secretary_create_versions.rb"
|
16
16
|
end
|
17
17
|
|
18
18
|
it 'copies the config' do
|
19
19
|
assert_file "config/initializers/secretary.rb"
|
20
20
|
end
|
21
|
-
|
22
21
|
end
|
metadata
CHANGED
@@ -1,126 +1,155 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: secretary-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
5
|
-
prerelease:
|
4
|
+
version: 1.1.1
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Bryan Ricker
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2014-
|
11
|
+
date: 2014-05-08 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: railties
|
16
|
-
requirement:
|
17
|
-
none: false
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - ">="
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: 3.2.0
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
|
-
version_requirements:
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 3.2.0
|
25
27
|
- !ruby/object:Gem::Dependency
|
26
28
|
name: activerecord
|
27
|
-
requirement:
|
28
|
-
none: false
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
29
30
|
requirements:
|
30
|
-
- -
|
31
|
+
- - ">="
|
31
32
|
- !ruby/object:Gem::Version
|
32
33
|
version: 3.2.0
|
33
34
|
type: :runtime
|
34
35
|
prerelease: false
|
35
|
-
version_requirements:
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 3.2.0
|
36
41
|
- !ruby/object:Gem::Dependency
|
37
42
|
name: diffy
|
38
|
-
requirement:
|
39
|
-
none: false
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
40
44
|
requirements:
|
41
|
-
- - ~>
|
45
|
+
- - "~>"
|
42
46
|
- !ruby/object:Gem::Version
|
43
47
|
version: 3.0.1
|
44
48
|
type: :runtime
|
45
49
|
prerelease: false
|
46
|
-
version_requirements:
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 3.0.1
|
47
55
|
- !ruby/object:Gem::Dependency
|
48
56
|
name: sqlite3
|
49
|
-
requirement:
|
50
|
-
none: false
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
51
58
|
requirements:
|
52
|
-
- -
|
59
|
+
- - ">="
|
53
60
|
- !ruby/object:Gem::Version
|
54
61
|
version: '0'
|
55
62
|
type: :development
|
56
63
|
prerelease: false
|
57
|
-
version_requirements:
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
58
69
|
- !ruby/object:Gem::Dependency
|
59
70
|
name: mysql2
|
60
|
-
requirement:
|
61
|
-
none: false
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
62
72
|
requirements:
|
63
|
-
- -
|
73
|
+
- - ">="
|
64
74
|
- !ruby/object:Gem::Version
|
65
75
|
version: '0'
|
66
76
|
type: :development
|
67
77
|
prerelease: false
|
68
|
-
version_requirements:
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: pg
|
71
|
-
requirement:
|
72
|
-
none: false
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
73
86
|
requirements:
|
74
|
-
- -
|
87
|
+
- - ">="
|
75
88
|
- !ruby/object:Gem::Version
|
76
89
|
version: '0'
|
77
90
|
type: :development
|
78
91
|
prerelease: false
|
79
|
-
version_requirements:
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
80
97
|
- !ruby/object:Gem::Dependency
|
81
98
|
name: rspec-rails
|
82
|
-
requirement:
|
83
|
-
none: false
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
84
100
|
requirements:
|
85
|
-
- -
|
101
|
+
- - ">="
|
86
102
|
- !ruby/object:Gem::Version
|
87
103
|
version: '0'
|
88
104
|
type: :development
|
89
105
|
prerelease: false
|
90
|
-
version_requirements:
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
91
111
|
- !ruby/object:Gem::Dependency
|
92
112
|
name: factory_girl
|
93
|
-
requirement:
|
94
|
-
none: false
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
95
114
|
requirements:
|
96
|
-
- -
|
115
|
+
- - ">="
|
97
116
|
- !ruby/object:Gem::Version
|
98
117
|
version: '0'
|
99
118
|
type: :development
|
100
119
|
prerelease: false
|
101
|
-
version_requirements:
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
102
125
|
- !ruby/object:Gem::Dependency
|
103
126
|
name: generator_spec
|
104
|
-
requirement:
|
105
|
-
none: false
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
106
128
|
requirements:
|
107
|
-
- - ~>
|
129
|
+
- - "~>"
|
108
130
|
- !ruby/object:Gem::Version
|
109
131
|
version: 0.9.1
|
110
132
|
type: :development
|
111
133
|
prerelease: false
|
112
|
-
version_requirements:
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: 0.9.1
|
113
139
|
- !ruby/object:Gem::Dependency
|
114
140
|
name: appraisal
|
115
|
-
requirement:
|
116
|
-
none: false
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
117
142
|
requirements:
|
118
|
-
- -
|
143
|
+
- - ">="
|
119
144
|
- !ruby/object:Gem::Version
|
120
145
|
version: 1.0.0.beta2
|
121
146
|
type: :development
|
122
147
|
prerelease: false
|
123
|
-
version_requirements:
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: 1.0.0.beta2
|
124
153
|
description: A Rails engine that provides simple versioning for your records.
|
125
154
|
email:
|
126
155
|
- bricker@scpr.org
|
@@ -128,26 +157,26 @@ executables: []
|
|
128
157
|
extensions: []
|
129
158
|
extra_rdoc_files: []
|
130
159
|
files:
|
160
|
+
- MIT-LICENSE
|
161
|
+
- README.md
|
162
|
+
- Rakefile
|
131
163
|
- app/models/concerns/secretary/user_activity_association.rb
|
132
164
|
- app/models/secretary/version.rb
|
133
165
|
- lib/generators/secretary/install_generator.rb
|
134
166
|
- lib/generators/secretary/templates/secretary_config.rb
|
135
167
|
- lib/generators/secretary/templates/versions_migration.rb
|
168
|
+
- lib/secretary-rails.rb
|
169
|
+
- lib/secretary.rb
|
136
170
|
- lib/secretary/config.rb
|
171
|
+
- lib/secretary/dirty_associations.rb
|
137
172
|
- lib/secretary/dirty_associations/collection.rb
|
138
173
|
- lib/secretary/dirty_associations/singular.rb
|
139
|
-
- lib/secretary/dirty_associations.rb
|
140
174
|
- lib/secretary/engine.rb
|
141
175
|
- lib/secretary/errors.rb
|
142
176
|
- lib/secretary/gem_version.rb
|
143
177
|
- lib/secretary/has_secretary.rb
|
144
178
|
- lib/secretary/tracks_association.rb
|
145
179
|
- lib/secretary/versioned_attributes.rb
|
146
|
-
- lib/secretary-rails.rb
|
147
|
-
- lib/secretary.rb
|
148
|
-
- MIT-LICENSE
|
149
|
-
- Rakefile
|
150
|
-
- README.md
|
151
180
|
- spec/factories.rb
|
152
181
|
- spec/internal/app/models/animal.rb
|
153
182
|
- spec/internal/app/models/car.rb
|
@@ -183,27 +212,26 @@ files:
|
|
183
212
|
homepage: https://github.com/scpr/secretary-rails
|
184
213
|
licenses:
|
185
214
|
- MIT
|
215
|
+
metadata: {}
|
186
216
|
post_install_message:
|
187
217
|
rdoc_options: []
|
188
218
|
require_paths:
|
189
219
|
- lib
|
190
220
|
required_ruby_version: !ruby/object:Gem::Requirement
|
191
|
-
none: false
|
192
221
|
requirements:
|
193
|
-
- -
|
222
|
+
- - ">="
|
194
223
|
- !ruby/object:Gem::Version
|
195
224
|
version: '0'
|
196
225
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
197
|
-
none: false
|
198
226
|
requirements:
|
199
|
-
- -
|
227
|
+
- - ">="
|
200
228
|
- !ruby/object:Gem::Version
|
201
229
|
version: '0'
|
202
230
|
requirements: []
|
203
231
|
rubyforge_project:
|
204
|
-
rubygems_version:
|
232
|
+
rubygems_version: 2.2.2
|
205
233
|
signing_key:
|
206
|
-
specification_version:
|
234
|
+
specification_version: 4
|
207
235
|
summary: Light-weight model versioning for ActiveRecord.
|
208
236
|
test_files:
|
209
237
|
- spec/factories.rb
|