strict_associations 0.1.8 → 0.1.9

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: c92d1223136a5265b920421b6905b4973aab91b4e6556d66e8a3d37fd07aba8b
4
- data.tar.gz: d11fb79bd366064f7d3179bb20b2255da37a531db99e8fc0173e74b841a873d9
3
+ metadata.gz: fdbb154fbdfc90017f2c4914e80146bcd5361dc6ee3c8379850bd9a4c0f9e210
4
+ data.tar.gz: cea9f6ec8124170cd6304aedf4687fad98c92e87d15c814c35cb42602a483e98
5
5
  SHA512:
6
- metadata.gz: 8ca2c4f5da3309031d53bee33e67d4f0bb42ddc7f676f7f307d1fa1075559bcb117ad5928478ff5b6488d7947a54c061687ca5a2f34cfc848befbe4236bd6d20
7
- data.tar.gz: e21378c926f911085b51d4fb5e0ab3b08db8ba12dbd1d9e5d3e6fa8abc8eb4f56e0431026cd9f1e16f05dfdb357279b156a3c5eca3e3734f1f5e01ab52780ec3
6
+ metadata.gz: 96307c12e6e8438a19e2ecd91d3a5403669b0b9444049c34f0581301da69265b23a006d65d09fbf483a32df313a5569fb42c952107d3ce7e0bf63f43c34765f8
7
+ data.tar.gz: 2025d94dae69ded231d3d2dc0f2fb806773103a06439b1c0a6185d7e5e3f83e215e60c76a00dd2e1dcc2d46f29e9c1f8057ab4528b245358734a68eab686e94e
data/CHANGELOG.md CHANGED
@@ -2,6 +2,6 @@
2
2
 
3
3
 
4
4
 
5
- ## [0.1.8] - Unreleased
5
+ ## [0.1.9] - Unreleased
6
6
 
7
- ## [0.1.7] - Unreleased
7
+ ## [0.1.8] - Unreleased
@@ -44,22 +44,11 @@ module StrictAssociations
44
44
  end
45
45
 
46
46
  def view?(model)
47
- conn = model.connection
48
- table = model.table_name
49
- conn.view_exists?(table) || materialized_view?(conn, table)
47
+ model.connection.view_exists?(model.table_name)
50
48
  rescue ActiveRecord::NoDatabaseError
51
49
  false
52
50
  end
53
51
 
54
- def materialized_view?(conn, table_name)
55
- return false unless conn.adapter_name == "PostgreSQL"
56
-
57
- conn.select_value(
58
- "SELECT 1 FROM pg_matviews WHERE matviewname = " \
59
- "#{conn.quote(table_name)}"
60
- ).present?
61
- end
62
-
63
52
  def check_habtm(model, violations)
64
53
  return if config.habtm_allowed?
65
54
 
@@ -125,6 +114,7 @@ module StrictAssociations
125
114
  target = resolve_target(ref)
126
115
  next unless target
127
116
  next if third_party?(target)
117
+ next if target_is_view?(ref)
128
118
 
129
119
  unless belongs_to_exists?(model, ref, target)
130
120
  violations << Violation.new(
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module StrictAssociations
4
- VERSION = "0.1.8"
4
+ VERSION = "0.1.9"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: strict_associations
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Lange