passive_columns 0.3.1 → 0.3.2

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: 3c37d7d720dab3e13b2084d7f6277a35b1d99de88b75eae8ef67b89d67472172
4
- data.tar.gz: 5ada8404f4509e694764d732892c2833d71c94c959c7ae45c080266781473e7e
3
+ metadata.gz: 0d9695006ebeabd65f0e14a0677f0161b90a13c2efc08718275a0f3c689f2d05
4
+ data.tar.gz: 78f853029324f5c67d042ba402ba469afc0b295f227a8dbc070eecdffcbfa8de
5
5
  SHA512:
6
- metadata.gz: b0ed4cbe6220e1752cb6f98e7b555f31bd178db3941f4a8c2e2d5fb022b3e00eb9abffc71a90cdb29f23fad14cc004e573850d51f9b18b1df3e0e05f4747d32e
7
- data.tar.gz: c73cf064d995e5c9705f609319e4f0609616d346cc17d1a41a8f4efe98cd5cbd934008ca6c0b7a3226d9a9967323038b0bf0fcf9e33f9c5b6ac3d199f86635f2
6
+ metadata.gz: 70793175ba5c45e30ac3807329948c75ddb8c48c3d22c861abbbc4dba5229165b58a0c77d899bd88ae1beba811768c485e91bc79ffdcaabdcad4276024e50d82
7
+ data.tar.gz: f1a0c0521c4c446453bbf5d675c16e12835a0db2d53276fe8515da9b5d143ee66415364d401536c35733ffb0c3c0023289f4df15f311a28765ac5272cfaf44bd
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Passive Columns
2
2
  A gem that extends `Active Record` to retrieve columns from DB on demand.<br>
3
- Works with `Rails` >= 7 and `Ruby` >= 2.7
3
+ Works with `Rails` >= 6.1 and `Ruby` >= 2.7
4
4
 
5
5
  ## Usage
6
6
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PassiveColumns
4
- VERSION = '0.3.1'
4
+ VERSION = '0.3.2'
5
5
  end
@@ -94,10 +94,12 @@ module PassiveColumns
94
94
  super(name, *filter_list, opts, &block)
95
95
  end
96
96
 
97
- def cached_find_by_statement(key, &block)
98
- cache = @find_by_statement_cache[connection.prepared_statements]
99
- cache.compute_if_absent(key) do
100
- ActiveRecord::StatementCache.create(connection) do |params|
97
+ def cached_find_by_statement(*args, &block)
98
+ con = args.size == 2 ? args[0] : connection
99
+ cache = @find_by_statement_cache[con.prepared_statements]
100
+
101
+ cache.compute_if_absent(args.last) do
102
+ ActiveRecord::StatementCache.create(con) do |params|
101
103
  relation = block.call params
102
104
  PassiveColumns.apply_select_scope_to(relation)
103
105
  relation
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: passive_columns
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitry Golovin
@@ -115,7 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
115
115
  - !ruby/object:Gem::Version
116
116
  version: '0'
117
117
  requirements: []
118
- rubygems_version: 3.1.6
118
+ rubygems_version: 3.5.11
119
119
  signing_key:
120
120
  specification_version: 4
121
121
  summary: A gem that extends Active Record to retrieve columns from a db on demand