abstract_finder 0.0.2 → 0.0.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: c2cd512d02c9a41dc385d4ff126bcdce014ebbe4f0c1b130849f3d682b83ad9c
4
- data.tar.gz: f95a7ebdcb012e83b0883da86542a5852210c705397da6febae389711666294c
3
+ metadata.gz: e794b2629b28b8123e3b507bcec0214ee4ebef2b9326fc04d69fcb2b8829f3d4
4
+ data.tar.gz: 939ef557195630cb238573ed372eacb9eb1658193697bbd37c50560602ce69aa
5
5
  SHA512:
6
- metadata.gz: 44b11a1234976fdfc7860118950380fa6221b23b908d0dc3c3fd4155db743e9147038045a9e1ed8fb95cf2242753068ae955a0a2f066349c754213fd844d4d6e
7
- data.tar.gz: fbc1a578b810be1fd9d512c725a8749ed7796789b7e9408f5c5d47d994bd5a1c2d53977c30d2f2eda5990ad0b0290991eda75878aac13f9e4742cef187e8502d
6
+ metadata.gz: 94b81991070b7320976a68679a4a0c072e06d4a08cc7f8a1f6e3fb40577c3283b5d5967dd3ee012c3a52ba37160e3702821adc54f15e7fab1ef87093d53e4bfb
7
+ data.tar.gz: 7565167f074c47e6f7dc47e21d1f50df422c8ed4998c332c80b8d4c32dd88d77d387709d5b42b0dd94a200326ec6554b3e78ddb245527e2958707c03c02f1aa6
data/README.md CHANGED
@@ -2,16 +2,16 @@
2
2
 
3
3
  ### API wrapper for search, pagination, filter.
4
4
 
5
- General idea to pass query, relations to avoid N+1 and permitted params to paginate, filter and sort AbstractFinder collection.
5
+ General idea to pass a query, relations to avoid N+1 and permitted params to paginate, filter and sort AbstractFinder collection.
6
6
 
7
7
 
8
8
  ``` ruby
9
9
  class RecordsContrroller < Api::BaseController
10
10
  def index
11
11
  finder = AbstractFinder.call(
12
- Record.latest, # scope, method or class
13
- %w[rating status],
14
- params
12
+ Record.latest, # scope, method or class
13
+ %w[rating status], # to fight N+1
14
+ params # permitted params for pagination, filtering, ordering and search
15
15
  )
16
16
 
17
17
  render json: RecordSerializer.new(
@@ -31,7 +31,7 @@ class BaseFinder
31
31
  def total
32
32
  return 0 if @collection.blank?
33
33
 
34
- @total ||= @collection.count
34
+ @total ||= @collection.size
35
35
  end
36
36
 
37
37
  def meta
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: abstract_finder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aleksei Ivanov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-05 00:00:00.000000000 Z
11
+ date: 2022-01-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: kaminari