historiographer 4.1.11 → 4.1.13

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: 8fe44573149356e074266299cc5da74332d9bc137b577a80f6f09baea0209b2d
4
- data.tar.gz: 36f1c1cda4de8385138642d0d70e410436f91052104af85190ac41b973cb485d
3
+ metadata.gz: fd03725f908a2620fb861adcaf012d37475521bd9571251e289c085f103851ae
4
+ data.tar.gz: a1ee8d9ab91bd575ac5b8bbc83ee0ce7fdc50ac239a0427a857d6e642b4bbfb8
5
5
  SHA512:
6
- metadata.gz: 2fc75dbf8c2826cf7d4df25dc07c0f37b1fccbe0eccc9a1d141302b56b50a779510c92cccb1bc28ecb2bfe15714692576041de50db355cb2d794a6dd33b5daaf
7
- data.tar.gz: cdbdecee2374394077f575df397ff2b3bee3b8c38a9b0ab17642ac924efd83d63b524b9c9a52e19721c5ef90f7f1d0c8c575084e8259439d21db878a4e27e097
6
+ metadata.gz: 603a5da6f6cad22c5082f94653de34dbc574adcab3a86d5d843a6fa6c5fdbbab0b4d3ed3fb33e32f46e947101db7f570970c99dfba63eac60410a09b284b30a5
7
+ data.tar.gz: f8d3c0697542b943579cdd79039de1c1723e9e0dcefd3013e03533e82bb68593a4f4ca46f8a62632f2aa945847b1c14ddf813d20db712a0be566a8b1b37df1a9
@@ -123,8 +123,8 @@ module Historiographer
123
123
  return if foreign_class.history_class.method_defined?(method_name)
124
124
 
125
125
  foreign_class.history_class.class_eval do
126
- define_method(method_name) do |*args, &block|
127
- forward_method(method_name, *args, &block)
126
+ define_method(method_name) do |*args, **kwargs, &block|
127
+ forward_method(method_name, *args, **kwargs, &block)
128
128
  end
129
129
  end
130
130
  ensure
@@ -133,17 +133,17 @@ module Historiographer
133
133
  end
134
134
  end
135
135
 
136
- foreign_class.columns.map(&:name).each do |method_name|
137
- define_method(method_name) do |*args, &block|
138
- forward_method(method_name, *args, &block)
136
+ (foreign_class.columns.map(&:name) - ["id"]).each do |method_name|
137
+ define_method(method_name) do |*args, **kwargs, &block|
138
+ forward_method(method_name, *args, **kwargs, &block)
139
139
  end
140
140
  end
141
141
 
142
142
  # Add method_missing for any methods we might have missed
143
- def method_missing(method_name, *args, &block)
143
+ def method_missing(method_name, *args, **kwargs, &block)
144
144
  original_class = self.class.class_variable_get(:@@original_class)
145
145
  if original_class.method_defined?(method_name)
146
- forward_method(method_name, *args, &block)
146
+ forward_method(method_name, *args, **kwargs, &block)
147
147
  else
148
148
  super
149
149
  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
@@ -399,12 +400,8 @@ module Historiographer
399
400
  @dummy_instance = instance
400
401
  end
401
402
 
402
- 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
403
+ def forward_method(method_name, *args, **kwargs, &block)
404
+ dummy_instance.send(method_name, *args, **kwargs, &block)
408
405
  end
409
406
  end
410
407
  end
@@ -1,3 +1,3 @@
1
1
  module Historiographer
2
- VERSION = "4.1.11"
2
+ VERSION = "4.1.13"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: historiographer
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.11
4
+ version: 4.1.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - brettshollenberger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-12-04 00:00:00.000000000 Z
11
+ date: 2024-12-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord