effective_resources 2.19.1 → 2.19.3

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: 6a849f72abd9e518e2f09b9e7f2d0bd57455c3e8c55546d73438be99449262d6
4
- data.tar.gz: 23826114e818b7cad96410296dd2e995e3487affd346da7dabbb0eaf3777bcf1
3
+ metadata.gz: ca109163a4ec655cfcf78c96a0f2551c6609291b0e75741ffe6b5a617dd16c63
4
+ data.tar.gz: d8b7fecb587b577aba0f5d4cf230ecb52b7bb9a0eab8a8c8973aa5dd4ac5f553
5
5
  SHA512:
6
- metadata.gz: 95059a03cb878f71e48311c1941eff23ac0ad4e8014d62c1fc1390a0fba5ce2789df8e32d6cfc7ac9e48f1a4ac6e5e4a3656832fd111a1deeae09620ce03943b
7
- data.tar.gz: 1cf6b7de896761c4a9963f2ff7df60f05db8bdabe68a4514ed37d2c87e54e4cbf8c07e0e1f91e8933adf200c115366a06f00296b5b7944d4b8cf4cbebf04b062
6
+ metadata.gz: 702fe66414e7f6126e094d5ca593d94a8f83c15b5b796767da270d98adb7fcefa5830abb007ae84baa75dee7980725eca42397efe6e5efe03618409c0d920dd2
7
+ data.tar.gz: fcc9eafd30c1d3deb81524873577a146a19604c74463105b2647cc9f49dee7422a1dde16d198719697821951e3949eb3c9bc08f22e3283e7a4dcd9cd317609d6
@@ -84,13 +84,19 @@ module Effective
84
84
  def resource_scope
85
85
  relation = effective_resource.relation
86
86
 
87
+ # This was explicitly set in the controller using resource_scope -> dsl
88
+ return relation if respond_to?(:resource_scope_relation)
89
+
90
+ # Otherwise, apply .jit_preload or .deep automatically
91
+
87
92
  # Apply jit_preloader if present
88
93
  if defined?(JitPreloader) && EffectiveResources.use_jit_preloader && relation.respond_to?(:includes_values)
89
94
  relation.includes_values = [] # Removes any previously defined .includes()
90
- relation.jit_preload
91
- else
92
- (relation.try(:deep) || relation)
95
+ return relation.jit_preload
93
96
  end
97
+
98
+ # Try .deep or return original relation
99
+ (relation.try(:deep) || relation)
94
100
  end
95
101
 
96
102
  def resource_name # 'thing'
@@ -318,7 +318,11 @@ module Effective
318
318
  relation.where("#{sql_column} >= ? AND #{sql_column} <= ?", term, end_at)
319
319
  end
320
320
  elsif value.respond_to?(:strftime) && operation == :eq
321
- relation.where(attribute.matches(value))
321
+ if as == :date
322
+ relation.where("#{sql_column} = ?", value)
323
+ else
324
+ relation.where("#{sql_column} >= ? AND #{sql_column} <= ?", value.beginning_of_day, value.end_of_day)
325
+ end
322
326
  end
323
327
 
324
328
  when :effective_obfuscation
@@ -1,3 +1,3 @@
1
1
  module EffectiveResources
2
- VERSION = '2.19.1'.freeze
2
+ VERSION = '2.19.3'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_resources
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.19.1
4
+ version: 2.19.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-12-04 00:00:00.000000000 Z
11
+ date: 2023-12-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails