paginated 1.0.1 → 1.0.2

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: 656e1f3fdd6c8b600f642a2e88fd395927ba28510a0ae8cdb2e34a4dddea25ea
4
- data.tar.gz: 94d7e802d02e4882c1ec74cd88395a263007a31939689a06cb92ef01ee60e4d8
3
+ metadata.gz: 9ae94c2ae8e872f233996072ec628db19b885a8538cafcf7ff3b75a2af99b933
4
+ data.tar.gz: 2fd627408f5ad65ae5da8e72fd9b393db0e8cdaf7f2d1b073f02135ce37ea474
5
5
  SHA512:
6
- metadata.gz: bd60a2ca45d5dbc33b085a5d6911619afcf841c2291c0976517b144e38bb41de453fd86fbc7b42ade9d38e5ff4bb307490411f69c532649e37ca78a5225fc5f2
7
- data.tar.gz: d3197bf624354ea4127a4527e35bbdb04a5bc35b8c8a83dc42db0afbc0a50f3105aa3f03bc5c7da139c3ef98f0011b8e9d48e14bf2cc9391d5837d501258e44a
6
+ metadata.gz: f73355fbbeda03857a8948618625392f69749f4bb968d9c4248662c31703db94cadb3a115013419d24b9fce418edf6db4db8c91dcbd6de855fae22a77a473ce0
7
+ data.tar.gz: 1297773a18228ed479111c7cc84fad0a500cfd4af7c87d456e9abe5cc825bdd161716b31b5ffa8ec53c352e0a2b81c8bd94e959c15e552f8ac733a346991e702
@@ -37,7 +37,7 @@ module Serialization
37
37
 
38
38
  def serialize_with_entity
39
39
  entity = @attrs[:entity].constantize
40
- @objects = @objects.map { |i| entity.represent(i).as_json }
40
+ @objects = @objects.map { |i| entity.represent(i, current_user: @current_user).as_json }
41
41
  end
42
42
 
43
43
  def sort_proc
data/lib/paginated.rb CHANGED
@@ -8,9 +8,10 @@ class Paginated
8
8
 
9
9
  def collection(**attrs)
10
10
  @attrs = attrs
11
+ @params = attrs[:serialization_scope].params.stringify_keys
12
+ @current_user = attrs[:serialization_scope].current_user
11
13
  @fields = attrs[:fields]
12
14
  @scopes = attrs[:scopes] || {}
13
- @params = attrs[:params].stringify_keys
14
15
  @offset = @params['offset'].to_i
15
16
  @limit = @params['limit'] || 20
16
17
  @order = attrs[:order] || :id
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paginated
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Павел Бабин