pg_serializable 1.0.0 → 1.0.1

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
  SHA1:
3
- metadata.gz: fc026e950ca7cd42a452b17f7ea42e69513298ff
4
- data.tar.gz: de6db447af2b2ba0f845dffeb29efd02c130089a
3
+ metadata.gz: 4ad9aa2e86537b9e90363067625b34571a0ddb0f
4
+ data.tar.gz: 45100cfb29c1b503e401d5d56ef17a9bb39c10b0
5
5
  SHA512:
6
- metadata.gz: 11102ebb57aa4da829575d9b7bc70d94a9fcf670175aaaa9089868d3df011c11f23e63f5e4c12ef85276532e1b76f2aaec1a0f004ee0e3a3052cb140c9a700be
7
- data.tar.gz: 0ea08435b36bda86588c0ed4c771e3e879c5d4ababd309b0c8f0969b6c269c25d2f001bdc16f33b80b40424376a33955d03438c13c57da98fda19a837a2837d8
6
+ metadata.gz: cecc2cd7e183a54ad507420bfbc9806a12fafe325276d1bcb3b0696ad436c1f70405428bb988538aa01c9f148fc8ee7782947fe1fb90258d56145b9d43916052
7
+ data.tar.gz: 8c9ad3b2547e69f8548f9faa1807ea00bebcb1a5b981903fbf263c05661ca2718fd9a0d6997687afa169fb62e827d89aee9951b63f4b0c815d26278bc62b5b1d
data/README.md CHANGED
@@ -44,6 +44,21 @@ end
44
44
  Completed 200 OK in 2521ms (Views: 2431.8ms | ActiveRecord: 45.7ms)
45
45
  ```
46
46
 
47
+ Using fast_jsonapi:
48
+ ```ruby
49
+ class Api::ProductsController < ApplicationController
50
+ def index
51
+ @products = Product.limit(200)
52
+ .order(updated_at: :desc)
53
+ .includes(:categories, :label, variations: :color)
54
+ render json: ProductSerializer.new(@products).serialized_json
55
+ end
56
+ end
57
+ ```
58
+ ```shell
59
+ Completed 200 OK in 315ms (Views: 0.2ms | ActiveRecord: 50.3ms)
60
+ ```
61
+
47
62
  Using PgSerializable:
48
63
  ```ruby
49
64
  class Api::ProductsController < ApplicationController
@@ -53,9 +68,18 @@ class Api::ProductsController < ApplicationController
53
68
  end
54
69
  ```
55
70
  ```shell
56
- Completed 200 OK in 89ms (Views: 0.1ms | ActiveRecord: 78.9ms)
71
+ Completed 200 OK in 109ms (Views: 0.2ms | ActiveRecord: 87.1ms)
57
72
  ```
58
73
 
74
+ Benchmarking `fast_jsonapi` against `pg_serializable` on 100 requests:
75
+ ```shell
76
+ user system total real
77
+ fast_jsonapi 21.510000 0.700000 22.210000 ( 26.994325)
78
+ pg_serializable 1.470000 0.170000 1.640000 ( 9.187275)
79
+ ```
80
+
81
+ You'll see the greatest benefits from PgSerializable for deeply nested json objects.
82
+
59
83
  ## Installation
60
84
 
61
85
  Add this line to your application's Gemfile:
@@ -475,14 +499,10 @@ render json: Product.limit(3).json(trait: :with_variations)
475
499
 
476
500
  TODO
477
501
 
478
- ## Contributing
479
-
480
- Bug reports and pull requests are welcome on GitHub at https://github.com/matthewjf/pg_serializable. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
481
-
482
502
  ## License
483
503
 
484
504
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
485
505
 
486
- ## Code of Conduct
506
+ ## Acknowledgements
487
507
 
488
- Everyone interacting in the PgSerializable project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/pg_serializable/blob/master/CODE_OF_CONDUCT.md).
508
+ Full credit Colin Rhodes for the idea.
@@ -1,3 +1,3 @@
1
1
  module PgSerializable
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
@@ -7,6 +7,8 @@ require 'pg_serializable/trait_manager'
7
7
  require 'pg_serializable/trait'
8
8
  require 'pg_serializable/visitors'
9
9
 
10
+ Oj.mimic_JSON()
11
+
10
12
  module ActiveRecord
11
13
  class Relation
12
14
  include PgSerializable::Visitable
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pg_serializable
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - matthewjf