refine-rails 2.13.4 → 2.13.5

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: 40da5d98e34b1e013ee9019520147512b97f1e7130ccca08d05b0ba0429e6540
4
- data.tar.gz: e8b762451c73d83718f1fb98811bbb89aa5d2dee1b3f5ec828c3f1da85f563c7
3
+ metadata.gz: b2336d0d23d8af77f9f090bfd8962c25a8c97c9d9f39ffce7be9fe2034d7affc
4
+ data.tar.gz: 191d8e607720235a354e4da42e640e0fd3ca5b29aca814c1a1a0531d75f01833
5
5
  SHA512:
6
- metadata.gz: 145af9023fa64fa006748da902668154244a59cf75a5669c9c47a8d038a06bdaa920fdf34207305837defe4390d1dfcc3533af7f257781f59b2a4db94cc82217
7
- data.tar.gz: 537698a2c4e28b6630e934adf7b13ccf0460b7f2fe3760e9189f4cd01340343a03ff57b178b5fc189e24b3e0dd039ec756c8a08baab17d2115405885ee13de8e
6
+ metadata.gz: f0fd3bc2e744d3de0fcd7092bd87d5969d472c886eacc7d007ff711bae937449588b48cb7ed5e56f590756f6d0f214fee2b690bdc9ead7676453b7e64e8862e5
7
+ data.tar.gz: 692abd2df6a29e0687f4aa4ad985ebf88371b5a72b7b45432d42e4837cc423272a98c15dc2a139bdebe7ac0a0d24a53b293b8f7f25e43081da1fc13013c555fd
@@ -78,6 +78,8 @@ module Refine::Conditions
78
78
  # can just reference the foreign key of the previous step in the relation chain
79
79
  through_reflection = get_through_reflection(instance: instance, relation: decompose_attribute[0])
80
80
  add_pending_joins_if_needed(instance: instance, reflection: through_reflection, input: input)
81
+ # TODO - this is not the right long-term place for this.
82
+ filter.needs_distinct = true
81
83
  @attribute = get_foreign_key_from_relation(instance: instance, reflection: through_reflection)
82
84
  else
83
85
  puts "TODO - not referencing an ID in attribute"
@@ -3,7 +3,7 @@
3
3
  # NOTE: This is more specialized query construction and it is up to the implementer to use the inspector tools to ensure this is only being used for supported queries
4
4
  module Refine
5
5
  module FlatQueryTools
6
- attr_accessor :pending_joins, :applied_conditions
6
+ attr_accessor :pending_joins, :applied_conditions, :needs_distinct
7
7
 
8
8
  def pending_joins
9
9
  @pending_joins ||= {}
@@ -13,6 +13,10 @@ module Refine
13
13
  @applied_conditions ||= {}
14
14
  end
15
15
 
16
+ def needs_distinct?
17
+ @needs_distinct ||= false
18
+ end
19
+
16
20
  def get_flat_query
17
21
  raise "Initial query must exist" if initial_query.nil?
18
22
  raise "Cannot make flat query for a filter using OR conditions" if uses_or?
@@ -51,6 +55,9 @@ module Refine
51
55
  if pending_joins.present?
52
56
  apply_pending_joins
53
57
  end
58
+ if needs_distinct?
59
+ @relation = @relation.distinct
60
+ end
54
61
  @relation
55
62
  end
56
63
 
@@ -1,5 +1,5 @@
1
1
  module Refine
2
2
  module Rails
3
- VERSION = "2.13.4"
3
+ VERSION = "2.13.5"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: refine-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.13.4
4
+ version: 2.13.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Colleen Schnettler
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2025-02-12 00:00:00.000000000 Z
12
+ date: 2025-02-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails