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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 70db618c74e384e96cbcbe8423f5da33067e8fc2
4
- data.tar.gz: 8a91d270fe8cf926ca7a62e9d55c639752986847
3
+ metadata.gz: dc4018adc384aedde4926997704d6ed6a77d7755
4
+ data.tar.gz: 71d323f660470debb95714e7dffbd1ccea26a19d
5
5
  SHA512:
6
- metadata.gz: 243e91ff837ebc98fae3a5e15de956eb089c3ac24ca33c4f2938476898dc0529514f23f81f7973d3b3aa99767ec6846a2cad3445ada91b8e440661038e915bbe
7
- data.tar.gz: 311762027c6211b5ff8ee10d63a860e79a5ceeca06442039fc55d5e9b2cfa102e764f7ac19de7e50f09e90d55e64860d5c05cd8b4e35650979500d38ab1911ba
6
+ metadata.gz: 9497ca10dd9127d1ad688c61ef02226d536c1eed7d4ba8593168457be6ef61538fc839f9c203e9179af96773b093d230109267586b64abcd451d8a5e2f48b801
7
+ data.tar.gz: 1e78d9423d811b5a0a416d8c15d6213a030bb7467705d16c93920fe3f96f11ac1e97dab74f9a9732751ae9b2cc9a7069003418b15cc7dbebb90e9a588b8b8acf
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- db_acts_as_versioned (3.4.1)
4
+ db_acts_as_versioned (3.5.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
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
 
@@ -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
@@ -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 => :delete_all
185
+ :dependent => options[:dependent_version_association] || nil
186
186
  }.merge(options[:association_options] || {})
187
187
 
188
188
  if block_given?
@@ -1,3 +1,3 @@
1
1
  module DbActsAsVersioned
2
- VERSION = "3.4.1"
2
+ VERSION = "3.5.0"
3
3
  end
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.1
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-08-07 00:00:00.000000000 Z
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