wor-paginate 0.1.5 → 0.1.6

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: e642dcd7e5593d0db78018d072f65cf1f0ead2393bed43e3c474c72738c06710
4
- data.tar.gz: 970b90f2c5dce5a30e250bb294c0cc83e67a8c742ccf47abf091b3243e572492
3
+ metadata.gz: b525d480a4cfe283c91c14c2a8e2ce570b65ded15e2678d76f1e9c0f35143a24
4
+ data.tar.gz: 585dfb16534cc0daafe39dbe52d238a8f1142f80bc65085c95acc9f2e506e9d1
5
5
  SHA512:
6
- metadata.gz: e4ec15809e387854ec114da96b562bb8136e4a840e8112b0d4c7e2e2dd3120c097740e0559caf93b4477b6059fc9377d200a2988a6c465f30d504dbf912ab77e
7
- data.tar.gz: f0e1ff9a99b57c4fa52a336bba2a3d13e7e1d79b493c39cb5e21b80b47fee7df5229ea01786f1100ac94c199f4c6322de9b4aca8c03088c3e41e44336aabd321
6
+ metadata.gz: da4b6ae0100e232077386f260c4465412d8cf010240a24011cd68308176f1c7082bbef1890c6f893c10a831d3ec56b8d2e005d33ec877d3f1d299d4888e4b053
7
+ data.tar.gz: 83e2ded8da3f41efb31765ed6ef29c076ec659e227c4aab579bf02a490f4c4afc6343a8a45fe3e456767195490fcd52f819a1b1e5f59bad85bb35e83693f4622
@@ -1,5 +1,7 @@
1
1
  ## Change log
2
2
 
3
+ ### V0.1.6
4
+ * [#62](https://github.com/Wolox/wor-paginate/pull/62): Add options in active model serializer - [@blacksam07](https://github.com/blacksam07).
3
5
 
4
6
  ### V0.1.5
5
7
  * [#59](https://github.com/Wolox/wor-paginate/pull/59): Add include option to serialize nested models - [@jcgrethe](https://github.com/jcgrethe).
data/README.md CHANGED
@@ -104,6 +104,20 @@ render_paginated DummyModel, each_serializer: CustomDummyModelSerializer
104
104
  ```
105
105
  where the serializer is just an [`ActiveModel::Serializer`](https://github.com/rails-api/active_model_serializers).
106
106
 
107
+ #### Custom options
108
+ Using custom options in serializer, example method `current_user`
109
+ ```ruby
110
+ render_paginated DummyModel, each_serializer: CustomDummyModelSerializer, current_user: current_user
111
+ ```
112
+ In serializer
113
+ ```ruby
114
+ class CustomSerializer < ActiveModel::Serializer
115
+ def method
116
+ @instance_options[:current_user]
117
+ end
118
+ end
119
+ ```
120
+
107
121
  #### Custom formatters
108
122
  A formatter is an object that defines the output of the render_paginated method. In case the application needs a different format for a request, it can be passed to the `render_paginated` method using the `formatter` option:
109
123
  ```ruby
@@ -33,7 +33,7 @@ module Wor
33
33
 
34
34
  def serialized_content
35
35
  if serializer.present?
36
- return paginated_content.map { |item| serializer.new(item, scope: options[:scope]) }
36
+ return paginated_content.map { |item| serializer.new(item, options) }
37
37
  end
38
38
  if defined? ActiveModelSerializers::SerializableResource
39
39
  ActiveModelSerializers::SerializableResource.new(paginated_content).as_json
@@ -1,5 +1,5 @@
1
1
  module Wor
2
2
  module Paginate
3
- VERSION = '0.1.5'.freeze
3
+ VERSION = '0.1.6'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wor-paginate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - icoluccio