historiographer 4.1.10 → 4.1.12

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
2
  SHA256:
3
- metadata.gz: e211bf451d7041d58702ebc28a4485eb3a073978aca72ef1933e9b5dcebc49fe
4
- data.tar.gz: 20ab524186b29a4c3dd44553a62b8853cf46a82aae4f139d18d3178b045cb35a
3
+ metadata.gz: 8bf0d68cafc68171d60d3ca3c98895fe7493e5dee98f61d98dc3f6c7af25107f
4
+ data.tar.gz: 921c92bdb41a6a4fb2676576675487cfb6b1a69db7db6b57455b33be1c222a78
5
5
  SHA512:
6
- metadata.gz: 055c01abfa33ab141ef48644ea38fa2a4052a9471d68519f89a659bbf45f83e37f66bb1aa847ba7014de9a46435af3cdced42d45ea122d25b70c409fdc312777
7
- data.tar.gz: d7df91b900b2ea61b4e366b67972242d2882feadf8cfebbd8cd0d67875782535d267e084ec9cf044c835b4da757a0602b1ca8e75f6f27310faf4fe7b7bf69931
6
+ metadata.gz: 8a426ce99a92d73ec05809e35c66b4c76cd6a8fab0e588f4733e94a6d18d159717b60f80b32e435957c0e5aec4b1e5c1a05cceead4ce88be209f9877f2253c35
7
+ data.tar.gz: 5f0c40ab48ca22082530598a91876f757b2b5b263ca6e39ac0657834194168baeb9924ba341316af63af3a85713d1bf8fdfdf3a8e026ee62858f6096d68cfa84
@@ -133,7 +133,7 @@ module Historiographer
133
133
  end
134
134
  end
135
135
 
136
- foreign_class.columns.map(&:name).each do |method_name|
136
+ (foreign_class.columns.map(&:name) - ["id"]).each do |method_name|
137
137
  define_method(method_name) do |*args, &block|
138
138
  forward_method(method_name, *args, &block)
139
139
  end
@@ -336,12 +336,12 @@ module Historiographer
336
336
  return @dummy_instance if @dummy_instance
337
337
 
338
338
  # Only exclude history-specific columns
339
- cannot_keep_cols = %w(history_started_at history_ended_at history_user_id snapshot_id)
339
+ cannot_keep_cols = %w(history_started_at history_ended_at history_user_id snapshot_id id)
340
340
  cannot_keep_cols += [self.class.history_foreign_key]
341
341
  cannot_keep_cols.map!(&:to_s)
342
342
 
343
343
  attrs = attributes.clone
344
- attrs[original_class.primary_key] = attrs[self.class.history_foreign_key]
344
+ # attrs[original_class.primary_key] = attrs[self.class.history_foreign_key]
345
345
 
346
346
  if original_class.sti_enabled?
347
347
  # Remove History suffix from type if present
@@ -368,6 +368,7 @@ module Historiographer
368
368
  history_methods.select! do |method|
369
369
  self.class.instance_method(method).source_location.first == history_class_location
370
370
  end
371
+ history_methods += [:is_history_class?]
371
372
 
372
373
  history_methods.each do |method_name|
373
374
  instance.singleton_class.class_eval do
@@ -400,11 +401,7 @@ module Historiographer
400
401
  end
401
402
 
402
403
  def forward_method(method_name, *args, &block)
403
- if method_name == :class || method_name == 'class'
404
- self.class
405
- else
406
- dummy_instance.send(method_name, *args, &block)
407
- end
404
+ dummy_instance.send(method_name, *args, &block)
408
405
  end
409
406
  end
410
407
  end
@@ -1,3 +1,3 @@
1
1
  module Historiographer
2
- VERSION = "4.1.10"
2
+ VERSION = "4.1.12"
3
3
  end
@@ -105,7 +105,7 @@ module Historiographer
105
105
  history_user_absent_action if history_user_id.nil?
106
106
 
107
107
  current_history = histories.where(history_ended_at: nil).order('id desc').limit(1).last
108
- current_history.update!(history_ended_at: UTC.now) if current_history.present?
108
+ current_history.update_columns(history_ended_at: UTC.now) if current_history.present?
109
109
 
110
110
  if respond_to?(:paranoia_destroy)
111
111
  self.history_user_id = history_user_id
@@ -115,6 +115,7 @@ module Historiographer
115
115
  destroy_without_history
116
116
  @no_history = false
117
117
  end
118
+ true
118
119
  end
119
120
 
120
121
  alias_method :destroy, :destroy_with_history
@@ -366,23 +367,6 @@ module Historiographer
366
367
  raise HistoryUserIdMissingError, 'history_user_id must be passed in order to save record with histories! If you are in a context with no history_user_id, explicitly call #save_without_user'
367
368
  end
368
369
 
369
- def list_callbacks(klass)
370
- callbacks = {}
371
-
372
- [:create, :update, :save, :destroy, :validation].each do |callback_type|
373
- chain = klass.send("_#{callback_type}_callbacks")
374
- callbacks[callback_type] = chain.map do |callback|
375
- {
376
- name: callback.filter,
377
- kind: callback.kind,
378
- options: callback.options
379
- }
380
- end
381
- end
382
-
383
- callbacks
384
- end
385
-
386
370
  #
387
371
  # Save a record of the most recent changes, with the current
388
372
  # time as history_started_at, and the provided user as history_user_id.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: historiographer
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.10
4
+ version: 4.1.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - brettshollenberger