logidze 0.6.3 → 0.6.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 954f27b8037b7a3a1f73ab87ef9358ede18b273c
4
- data.tar.gz: 66f9848eda590c426b3bb7694cadf2bc6224fba0
2
+ SHA256:
3
+ metadata.gz: dbf55af423b22297d9d4c48f956e690b344bf18004b3974a0b8f676b1421d785
4
+ data.tar.gz: f437d9de08708218a92a56d70f69b2feec71567969a53ebc721296c44f69e98f
5
5
  SHA512:
6
- metadata.gz: fdca34e05f8021233e5b1663ccc773553725b6108728e1f407545dab153e917d0dc12c6ffebccc5a802fe576f51cedd653a89c93b281d7132682590bac5e1687
7
- data.tar.gz: 024a6a76b6ea16bad9218a0a07b3c275dc629e353abf325630b9036c306e5a1da30d975ed1ae98d0f6dd164b980fc18d87397872f2f8e3e25daddedb1813db64
6
+ metadata.gz: 3b172c5de15657c9f29e2cfab38cda6efacf34342a1aa886dc478fa83d7b495f7c394427960f873c5b2eb8b1ee09dcafdaff8240045b554945df40b9d36732ac
7
+ data.tar.gz: 980edce48471bb6cf87a5c20da384983cccdab61305fe445627fc16af0a1f5cee3cf218e5530b3074915089cea6e2a6375686118e1516fb686b091d5aef4667a
data/.rubocop.yml CHANGED
@@ -24,6 +24,9 @@ AllCops:
24
24
  Naming/AccessorMethodName:
25
25
  Enabled: false
26
26
 
27
+ Naming/UncommunicativeMethodParamName:
28
+ Enabled: false
29
+
27
30
  Style/TrivialAccessors:
28
31
  Enabled: false
29
32
 
data/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  ## master
4
4
 
5
+ ## 0.6.4 (2018-04-30)
6
+
7
+ - [Fixes [#70](https://github.com/palkan/logidze/issues/70)] Ignore missing (e.g. removed) columns in diffs and past versions. ([@palkan][])
8
+
9
+ This is a quick fix for a more general problem (see [#59](https://github.com/palkan/logidze/issues/59)).
10
+
5
11
  ## 0.6.3 (2018-01-17)
6
12
 
7
13
  - [Fixes [#57](https://github.com/palkan/logidze/issues/57)] Support associations versioning for `at(version:)`. ([@palkan][])
data/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  [![Gem Version](https://badge.fury.io/rb/logidze.svg)](https://rubygems.org/gems/logidze) [![Build Status](https://travis-ci.org/palkan/logidze.svg?branch=master)](https://travis-ci.org/palkan/logidze) [![Circle CI](https://circleci.com/gh/palkan/logidze/tree/master.svg?style=svg)](https://circleci.com/gh/palkan/logidze/tree/master)
2
2
  [![Dependency Status](https://dependencyci.com/github/palkan/logidze/badge)](https://dependencyci.com/github/palkan/logidze)
3
+ [![Open Source Helpers](https://www.codetriage.com/palkan/logidze/badges/users.svg)](https://www.codetriage.com/palkan/logidze)
3
4
 
4
5
  # Logidze
5
6
 
@@ -7,7 +7,7 @@ module Logidze
7
7
  class InstallGenerator < ::Rails::Generators::Base # :nodoc:
8
8
  include Rails::Generators::Migration
9
9
 
10
- source_root File.expand_path('../templates', __FILE__)
10
+ source_root File.expand_path('templates', __dir__)
11
11
 
12
12
  class_option :update, type: :boolean, optional: true,
13
13
  desc: "Define whether this is an update migration"
@@ -1,5 +1,5 @@
1
1
  class <%= @migration_class_name %> < ActiveRecord::Migration<%= ActiveRecord::VERSION::MAJOR < 5 ? '' : '[5.0]' %>
2
- def change
3
- enable_extension :hstore
4
- end
2
+ def change
3
+ enable_extension :hstore
4
+ end
5
5
  end
@@ -6,7 +6,7 @@ require "rails/generators/active_record/migration/migration_generator"
6
6
  module Logidze
7
7
  module Generators
8
8
  class ModelGenerator < ::ActiveRecord::Generators::Base # :nodoc:
9
- source_root File.expand_path('../templates', __FILE__)
9
+ source_root File.expand_path('templates', __dir__)
10
10
 
11
11
  class_option :limit, type: :numeric, optional: true, desc: "Specify history size limit"
12
12
 
data/lib/logidze/model.rb CHANGED
@@ -134,6 +134,8 @@ module Logidze
134
134
  deserialize_changes!(v)
135
135
  end
136
136
 
137
+ changes.delete_if { |k, _v| deleted_column?(k) }
138
+
137
139
  { "id" => id, "changes" => changes }
138
140
  end
139
141
 
@@ -203,6 +205,7 @@ module Logidze
203
205
  end
204
206
 
205
207
  def apply_column_diff(column, value)
208
+ return if deleted_column?(column)
206
209
  write_attribute column, deserialize_value(column, value)
207
210
  end
208
211
 
@@ -225,6 +228,10 @@ module Logidze
225
228
  end
226
229
  end
227
230
 
231
+ def deleted_column?(column)
232
+ !@attributes.key?(column)
233
+ end
234
+
228
235
  def deserialize_changes!(diff)
229
236
  diff.each do |k, v|
230
237
  v["old"] = deserialize_value(k, v["old"])
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Logidze
3
- VERSION = "0.6.3"
3
+ VERSION = "0.6.4"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logidze
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.3
4
+ version: 0.6.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - palkan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-01-17 00:00:00.000000000 Z
11
+ date: 2018-04-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -254,7 +254,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
254
254
  version: '0'
255
255
  requirements: []
256
256
  rubyforge_project:
257
- rubygems_version: 2.6.13
257
+ rubygems_version: 2.7.4
258
258
  signing_key:
259
259
  specification_version: 4
260
260
  summary: PostgreSQL JSON-based auditing