db_acts_as_versioned 3.4.1 → 3.5.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/Gemfile.lock +1 -1
- data/README.md +9 -0
- data/RUNNING_UNIT_TESTS +41 -0
- data/lib/db_acts_as_versioned.rb +1 -1
- data/lib/db_acts_as_versioned/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc4018adc384aedde4926997704d6ed6a77d7755
|
4
|
+
data.tar.gz: 71d323f660470debb95714e7dffbd1ccea26a19d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9497ca10dd9127d1ad688c61ef02226d536c1eed7d4ba8593168457be6ef61538fc839f9c203e9179af96773b093d230109267586b64abcd451d8a5e2f48b801
|
7
|
+
data.tar.gz: 1e78d9423d811b5a0a416d8c15d6213a030bb7467705d16c93920fe3f96f11ac1e97dab74f9a9732751ae9b2cc9a7069003418b15cc7dbebb90e9a588b8b8acf
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -3,6 +3,15 @@
|
|
3
3
|
|
4
4
|
acts_as_versioned is a gem for Rails 3.1, 3.2 & 4 to enable easy versioning of models. As a versioned model is updated revisions are kept in a seperate table, providing a record of what changed.
|
5
5
|
|
6
|
+
## Update:
|
7
|
+
|
8
|
+
The forked acts_as_versioned code systematically deleted records in the version table, when the associated record was deleted in the parent table. This seemed both illogical to me, and created "gaps" in the data history. Given this, starting in version 3.5.0, I made the feature optional, with the new default behavior to "save deleted records in the version table".
|
9
|
+
|
10
|
+
For anyone wanting to retain the original functionality (deleting history of deleted parent records), add the new "dependent_version_association: option:
|
11
|
+
|
12
|
+
acts_as_versioned :dependent_version_association => :delete_all
|
13
|
+
|
14
|
+
|
6
15
|
## Getting Started ##
|
7
16
|
=====
|
8
17
|
|
data/RUNNING_UNIT_TESTS
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
== Creating the test database
|
2
|
+
|
3
|
+
The default name for the test databases is "activerecord_versioned". If you
|
4
|
+
want to use another database name then be sure to update the connection
|
5
|
+
adapter setups you want to test with in test/connections/<your database>/connection.rb.
|
6
|
+
When you have the database online, you can import the fixture tables with
|
7
|
+
the test/fixtures/db_definitions/*.sql files.
|
8
|
+
|
9
|
+
Make sure that you create database objects with the same user that you specified in i
|
10
|
+
connection.rb otherwise (on Postgres, at least) tests for default values will fail.
|
11
|
+
|
12
|
+
== Running with Rake
|
13
|
+
|
14
|
+
The easiest way to run the unit tests is through Rake. The default task runs
|
15
|
+
the entire test suite for all the adapters. You can also run the suite on just
|
16
|
+
one adapter by using the tasks test_mysql_ruby, test_ruby_mysql, test_sqlite,
|
17
|
+
or test_postresql. For more information, checkout the full array of rake tasks with "rake -T"
|
18
|
+
|
19
|
+
Rake can be found at http://rake.rubyforge.org
|
20
|
+
|
21
|
+
== Running by hand
|
22
|
+
|
23
|
+
Unit tests are located in test directory. If you only want to run a single test suite,
|
24
|
+
or don't want to bother with Rake, you can do so with something like:
|
25
|
+
|
26
|
+
cd test; ruby -I "connections/native_mysql" base_test.rb
|
27
|
+
|
28
|
+
That'll run the base suite using the MySQL-Ruby adapter. Change the adapter
|
29
|
+
and test suite name as needed.
|
30
|
+
|
31
|
+
== Faster tests
|
32
|
+
|
33
|
+
If you are using a database that supports transactions, you can set the
|
34
|
+
"AR_TX_FIXTURES" environment variable to "yes" to use transactional fixtures.
|
35
|
+
This gives a very large speed boost. With rake:
|
36
|
+
|
37
|
+
rake AR_TX_FIXTURES=yes
|
38
|
+
|
39
|
+
Or, by hand:
|
40
|
+
|
41
|
+
AR_TX_FIXTURES=yes ruby -I connections/native_sqlite3 base_test.rb
|
data/lib/db_acts_as_versioned.rb
CHANGED
@@ -182,7 +182,7 @@ module ActiveRecord #:nodoc:
|
|
182
182
|
self.version_association_options = {
|
183
183
|
:class_name => "#{self.to_s}::#{versioned_class_name}",
|
184
184
|
:foreign_key => versioned_foreign_key,
|
185
|
-
:dependent => :
|
185
|
+
:dependent => options[:dependent_version_association] || nil
|
186
186
|
}.merge(options[:association_options] || {})
|
187
187
|
|
188
188
|
if block_given?
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: db_acts_as_versioned
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sommer Systems, LLC
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-10-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -53,6 +53,7 @@ files:
|
|
53
53
|
- Gemfile.lock
|
54
54
|
- LICENSE.txt
|
55
55
|
- README.md
|
56
|
+
- RUNNING_UNIT_TESTS
|
56
57
|
- Rakefile
|
57
58
|
- db_acts_as_versioned.gemspec
|
58
59
|
- lib/db_acts_as_versioned.rb
|