active_snapshot 0.2.2 → 0.2.3

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
  SHA256:
3
- metadata.gz: 52936ec96ea62b55a0daa2b3ba82a38030f213d34fe432e3e3ad71ccdae52ced
4
- data.tar.gz: e4045721201c1de8d893a9ce8b6d03360feef0487e68dc8aab38b92394906b9a
3
+ metadata.gz: 7f9f530f0b44c50f31da3e79937c51551bc03ef8fe3d730c500068d642f10df5
4
+ data.tar.gz: '029ad3e165ef4bba92031c1db765335a0cee40b419ab5d4c4c1ed7b402dca595'
5
5
  SHA512:
6
- metadata.gz: c084a674774818ebf79d847828e7237b7475aa15f3df7ac62bbdcee45b0d0eb2f5eb64f87c029302d59a5b1c491b194cc960cb7bd720649d067862c3bd8e8400
7
- data.tar.gz: 3b6a20bd90380ca962941ee81a915e3b86b806c768dfd3f9d5978ab2a2b2f637d03becc24458afefef8d9054b46eaebf6cd4e3761e69f8e47f4b074ad7323aee
6
+ metadata.gz: 9a502d15dda8b60c30e20a3fe6feea694e92569f6ce44eca50fd0544b14947df44499d727502345527c6456b681995673d78ebd80ac4bf6117d9868535c06275
7
+ data.tar.gz: cf6014aa8d08761a4e38be0769917732610b7b1fe41925c9f5d02c36a53ad0551b7781ed85e333792b936e2c823884f38face8310bc8a6f25845e4995ac7c6e8
data/CHANGELOG.md CHANGED
@@ -2,9 +2,14 @@ CHANGELOG
2
2
  ---------
3
3
 
4
4
  - **UNRELEASED**
5
- * [View Diff](https://github.com/westonganger/active_snapshot/compare/v0.2.2...master)
5
+ * [View Diff](https://github.com/westonganger/active_snapshot/compare/v0.2.3...master)
6
6
  * Nothing yet
7
7
 
8
+ - **UNRELEASED**
9
+ * [View Diff](https://github.com/westonganger/active_snapshot/compare/v0.2.2...v0.2.3)
10
+ * Support Ruby 3.1
11
+ * Fix unique constraint on snapshots.identifier column
12
+
8
13
  - **v0.2.2** - August 27, 2021
9
14
  * [View Diff](https://github.com/westonganger/active_snapshot/compare/v0.2.1...v0.2.2)
10
15
  * [0715279](https://github.com/westonganger/active_snapshot/commit/0715279) - Fix bug on restore for in `has_snapshot_children` method with nil association values
@@ -16,7 +16,13 @@ module ActiveSnapshot
16
16
  validates :user_type, presence: true, if: :user_id
17
17
 
18
18
  def metadata
19
- @metadata ||= YAML.load(self[:metadata]).with_indifferent_access
19
+ yaml_method = "unsafe_load"
20
+
21
+ if !YAML.respond_to?("unsafe_load")
22
+ yaml_method = "load"
23
+ end
24
+
25
+ @metadata ||= YAML.send(yaml_method, self[:metadata]).with_indifferent_access
20
26
  end
21
27
 
22
28
  def metadata=(h)
@@ -14,7 +14,13 @@ module ActiveSnapshot
14
14
  validates :item_type, presence: true, uniqueness: { scope: [:snapshot_id, :item_id] }
15
15
 
16
16
  def object
17
- @object ||= YAML.load(self[:object]).with_indifferent_access
17
+ yaml_method = "unsafe_load"
18
+
19
+ if !YAML.respond_to?("unsafe_load")
20
+ yaml_method = "load"
21
+ end
22
+
23
+ @metadata ||= YAML.send(yaml_method, self[:object]).with_indifferent_access
18
24
  end
19
25
 
20
26
  def object=(h)
@@ -1,3 +1,3 @@
1
1
  module ActiveSnapshot
2
- VERSION = "0.2.2".freeze
2
+ VERSION = "0.2.3".freeze
3
3
  end
@@ -3,7 +3,7 @@ class <%= migration_name %> < ActiveRecord::Migration::Current
3
3
  def change
4
4
  create_table :snapshots<%= table_options %> do |t|
5
5
  t.belongs_to :item, polymorphic: true, null: false, index: true
6
- t.string :identifier, null: false, unique: true, index: true
6
+ t.string :identifier, null: false, unique: [:item_id, :item_type], index: true
7
7
  t.belongs_to :user, polymorphic: true
8
8
  t.text :metadata
9
9
  t.datetime :created_at, null: false
@@ -34,14 +34,6 @@ module Dummy
34
34
  # Configure sensitive parameters which will be filtered from the log file.
35
35
  config.filter_parameters += [:password]
36
36
 
37
- # Enable the asset pipeline
38
- config.assets.enabled = true
39
-
40
- config.assets.quiet = true
41
-
42
- # Version of your assets, change this if you want to expire all your assets
43
- config.assets.version = '1.0'
44
-
45
37
  config.generators.test_framework = false
46
38
  config.generators.helper = false
47
39
  config.generators.stylesheets = false
data/test/test_helper.rb CHANGED
@@ -50,7 +50,7 @@ klasses = [
50
50
  ]
51
51
 
52
52
  klasses.each do |klass|
53
- if defined?(SQLite3)
53
+ if klass.connection.adapter_name.downcase.include?("sqlite")
54
54
  ActiveRecord::Base.connection.execute("DELETE FROM #{klass.table_name};")
55
55
  ActiveRecord::Base.connection.execute("UPDATE `sqlite_sequence` SET `seq` = 0 WHERE `name` = '#{klass.table_name}';")
56
56
  else
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_snapshot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Weston Ganger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-27 00:00:00.000000000 Z
11
+ date: 2022-01-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -157,8 +157,6 @@ files:
157
157
  - test/dummy_app/config/boot.rb
158
158
  - test/dummy_app/config/database.yml
159
159
  - test/dummy_app/config/environment.rb
160
- - test/dummy_app/config/environments/development.rb
161
- - test/dummy_app/config/environments/production.rb
162
160
  - test/dummy_app/config/environments/test.rb
163
161
  - test/dummy_app/config/initializers/backtrace_silencers.rb
164
162
  - test/dummy_app/config/initializers/inflections.rb
@@ -226,8 +224,6 @@ test_files:
226
224
  - test/dummy_app/config/secrets.yml
227
225
  - test/dummy_app/config/routes.rb
228
226
  - test/dummy_app/config/locales/en.yml
229
- - test/dummy_app/config/environments/production.rb
230
- - test/dummy_app/config/environments/development.rb
231
227
  - test/dummy_app/config/environments/test.rb
232
228
  - test/dummy_app/config/environment.rb
233
229
  - test/dummy_app/config/application.rb
@@ -1,30 +0,0 @@
1
- Dummy::Application.configure do
2
- # Settings specified here will take precedence over those in config/application.rb
3
-
4
- # In the development environment your application's code is reloaded on
5
- # every request. This slows down response time but is perfect for development
6
- # since you don't have to restart the web server when you make code changes.
7
- config.cache_classes = false
8
-
9
- # Log error messages when you accidentally call methods on nil.
10
- config.whiny_nils = true
11
-
12
- # Show full error reports and disable caching
13
- config.consider_all_requests_local = true
14
- config.action_controller.perform_caching = false
15
-
16
- # Don't care if the mailer can't send
17
- config.action_mailer.raise_delivery_errors = false
18
-
19
- # Print deprecation notices to the Rails logger
20
- config.active_support.deprecation = :log
21
-
22
- # Only use best-standards-support built into browsers
23
- config.action_dispatch.best_standards_support = :builtin
24
-
25
- # Do not compress assets
26
- config.assets.compress = false
27
-
28
- # Expands the lines which load the assets
29
- config.assets.debug = true
30
- end
@@ -1,60 +0,0 @@
1
- Dummy::Application.configure do
2
- # Settings specified here will take precedence over those in config/application.rb
3
-
4
- # Code is not reloaded between requests
5
- config.cache_classes = true
6
-
7
- # Full error reports are disabled and caching is turned on
8
- config.consider_all_requests_local = false
9
- config.action_controller.perform_caching = true
10
-
11
- # Disable Rails's static asset server (Apache or nginx will already do this)
12
- config.serve_static_files = false
13
-
14
- # Compress JavaScripts and CSS
15
- config.assets.compress = true
16
-
17
- # Don't fallback to assets pipeline if a precompiled asset is missed
18
- config.assets.compile = false
19
-
20
- # Generate digests for assets URLs
21
- config.assets.digest = true
22
-
23
- # Defaults to Rails.root.join("public/assets")
24
- # config.assets.manifest = YOUR_PATH
25
-
26
- # Specifies the header that your server uses for sending files
27
- # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
28
- # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
29
-
30
- # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
31
- # config.force_ssl = true
32
-
33
- # See everything in the log (default is :info)
34
- # config.log_level = :debug
35
-
36
- # Use a different logger for distributed setups
37
- # config.logger = SyslogLogger.new
38
-
39
- # Use a different cache store in production
40
- # config.cache_store = :mem_cache_store
41
-
42
- # Enable serving of images, stylesheets, and JavaScripts from an asset server
43
- # config.action_controller.asset_host = "http://assets.example.com"
44
-
45
- # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
46
- # config.assets.precompile += %w( search.js )
47
-
48
- # Disable delivery errors, bad email addresses will be ignored
49
- # config.action_mailer.raise_delivery_errors = false
50
-
51
- # Enable threaded mode
52
- # config.threadsafe!
53
-
54
- # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
55
- # the I18n.default_locale when a translation can not be found)
56
- config.i18n.fallbacks = true
57
-
58
- # Send deprecation notices to registered listeners
59
- config.active_support.deprecation = :notify
60
- end