glib-web 4.34.0 → 4.34.1

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: c16c0b1492e8c1d4fb291c5d0583ec13c4992ca2b5ec316a62b416d8a28b7d6b
4
- data.tar.gz: b66e7297e95ba58a93926d161c545fbe37f4dbf74c9791709918035390c13194
3
+ metadata.gz: a897a2657114bf12b52da917ad8857e4b7e1070bc99eefe7e4cc49c519508bdb
4
+ data.tar.gz: 2bf662a93d9a308f5eec89dc7d3562b4ddc7462886f0ec0a239bd64dd81c75d0
5
5
  SHA512:
6
- metadata.gz: ba8ba85ef6ff6fedcd0099bbcd61fc9296b37aafe83b44537583b7fe61c1e1e05a35b72b70850a36b19ae6a04df35ceafad75a4c7d6b8056403960a26db4802c
7
- data.tar.gz: a375d20580ee3e4e3df3a2134b1db9ada9758d2e2516b6ce1ce4e80be1bb47514650a2fa017f919da88e0eb267563b15c639099b924c29b7316db734558c1d9e
6
+ metadata.gz: c8a8915e195ed0e6e5f9e39789fdb886887cdb264e7fbc873f3833906be02b44308ca9a7488a9ad30170720ab0e9761ef46dbdf7e230edaac81f3da764c5fe63
7
+ data.tar.gz: 4e8d8a377ccf28259fcde1ce4d265cddf4d67096a391e96aabecd48a77742d1ace91775b322614879a355fb1b2d0728144461eb3ff4677983a4013d4bd20bf76
@@ -313,7 +313,7 @@ module Glib::Json::Libs
313
313
  end
314
314
  end
315
315
 
316
- def json_libs_rescue_csrf
316
+ def json_libs_rescue_csrf(sign_in_url_proc)
317
317
  rescue_from ActionController::InvalidAuthenticityToken do |exception|
318
318
  # sign_out(:user)
319
319
 
@@ -330,7 +330,7 @@ module Glib::Json::Libs
330
330
 
331
331
  respond_to do |format|
332
332
  format.html do
333
- redirect_to sign_in_url
333
+ redirect_to instance_exec(&sign_in_url_proc)
334
334
  end
335
335
  format.json do
336
336
  render json: {
@@ -116,7 +116,7 @@ module Glib
116
116
 
117
117
  # Use `send()` instead of `association(relationship).scope` because the latter returns new record objects as opposed
118
118
  # to existing objects which could cause a side effect.
119
- relation = send(relationship)
119
+ relation = public_send(relationship)
120
120
 
121
121
  # Use `each` instead of `find_each` because `each` is cached which is important to retain the
122
122
  # `marked_for_destruction` status.
data/lib/glib/snapshot.rb CHANGED
@@ -13,10 +13,31 @@ module Glib
13
13
 
14
14
  before_save do
15
15
  self.attributes_before_save = attributes_in_database
16
- self.snapshot_changed = changed?
16
+ self.snapshot_changed = check_snapshot_changed
17
17
  end
18
18
  end
19
19
 
20
+ def check_snapshot_changed
21
+ return true if changed?
22
+
23
+ associations_for_snapshot.each do |association_name|
24
+ if (association = self.class.reflect_on_association(association_name))
25
+ case association.macro
26
+ when :has_many
27
+ public_send(association_name).each do |record|
28
+ return true if record.changed?
29
+ end
30
+ when :has_one, :belongs_to
31
+ return true if public_send(association_name).changed?
32
+ end
33
+ else
34
+ raise "Invalid association: #{association_name}"
35
+ end
36
+ end
37
+
38
+ false
39
+ end
40
+
20
41
  def where_snapshots(user: nil, field: nil, action: nil, association: nil, association_action: nil, like: nil)
21
42
  query = snapshots
22
43
 
metadata CHANGED
@@ -1,11 +1,11 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glib-web
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.34.0
4
+ version: 4.34.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
  date: 2019-10-04 00:00:00.000000000 Z
@@ -122,7 +122,7 @@ dependencies:
122
122
  - - ">="
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
- description:
125
+ description:
126
126
  email: ''
127
127
  executables: []
128
128
  extensions: []
@@ -426,10 +426,10 @@ files:
426
426
  - lib/glib/value.rb
427
427
  - lib/glib/version.rb
428
428
  - lib/tasks/db.rake
429
- homepage:
429
+ homepage:
430
430
  licenses: []
431
431
  metadata: {}
432
- post_install_message:
432
+ post_install_message:
433
433
  rdoc_options: []
434
434
  require_paths:
435
435
  - lib
@@ -445,7 +445,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
445
445
  version: '0'
446
446
  requirements: []
447
447
  rubygems_version: 3.4.6
448
- signing_key:
448
+ signing_key:
449
449
  specification_version: 4
450
450
  summary: ''
451
451
  test_files: []