active_model_serializers 0.9.9 → 0.10.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (135) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +21 -0
  3. data/.travis.yml +27 -0
  4. data/CHANGELOG.md +8 -204
  5. data/CONTRIBUTING.md +23 -12
  6. data/Gemfile +17 -0
  7. data/{MIT-LICENSE → LICENSE.txt} +3 -2
  8. data/README.md +151 -781
  9. data/Rakefile +12 -0
  10. data/active_model_serializers.gemspec +26 -0
  11. data/lib/action_controller/serialization.rb +30 -75
  12. data/lib/active_model/serializer/adapter/fragment_cache.rb +78 -0
  13. data/lib/active_model/serializer/adapter/json/fragment_cache.rb +15 -0
  14. data/lib/active_model/serializer/adapter/json.rb +52 -0
  15. data/lib/active_model/serializer/adapter/json_api/fragment_cache.rb +22 -0
  16. data/lib/active_model/serializer/adapter/json_api.rb +152 -0
  17. data/lib/active_model/serializer/adapter/null.rb +11 -0
  18. data/lib/active_model/serializer/adapter.rb +87 -0
  19. data/lib/active_model/serializer/array_serializer.rb +32 -0
  20. data/lib/active_model/serializer/configuration.rb +13 -0
  21. data/lib/active_model/serializer/fieldset.rb +40 -0
  22. data/lib/active_model/serializer/version.rb +1 -1
  23. data/lib/active_model/serializer.rb +192 -267
  24. data/lib/active_model_serializers.rb +5 -7
  25. data/lib/generators/serializer/USAGE +6 -0
  26. data/lib/{active_model/serializer/generators → generators}/serializer/serializer_generator.rb +8 -8
  27. data/lib/{active_model/serializer/generators → generators}/serializer/templates/serializer.rb +2 -2
  28. data/test/action_controller/adapter_selector_test.rb +51 -0
  29. data/test/action_controller/explicit_serializer_test.rb +110 -0
  30. data/test/action_controller/json_api_linked_test.rb +173 -0
  31. data/test/action_controller/serialization_scope_name_test.rb +63 -0
  32. data/test/action_controller/serialization_test.rb +365 -0
  33. data/test/adapter/fragment_cache_test.rb +27 -0
  34. data/test/adapter/json/belongs_to_test.rb +41 -0
  35. data/test/adapter/json/collection_test.rb +59 -0
  36. data/test/adapter/json/has_many_test.rb +36 -0
  37. data/test/adapter/json_api/belongs_to_test.rb +147 -0
  38. data/test/adapter/json_api/collection_test.rb +89 -0
  39. data/test/adapter/json_api/has_many_embed_ids_test.rb +45 -0
  40. data/test/adapter/json_api/has_many_explicit_serializer_test.rb +98 -0
  41. data/test/adapter/json_api/has_many_test.rb +106 -0
  42. data/test/adapter/json_api/has_one_test.rb +59 -0
  43. data/test/adapter/json_api/linked_test.rb +257 -0
  44. data/test/adapter/json_test.rb +34 -0
  45. data/test/adapter/null_test.rb +25 -0
  46. data/test/adapter_test.rb +43 -0
  47. data/test/array_serializer_test.rb +29 -0
  48. data/test/fixtures/poro.rb +123 -171
  49. data/test/serializers/adapter_for_test.rb +50 -0
  50. data/test/serializers/associations_test.rb +106 -0
  51. data/test/serializers/attribute_test.rb +23 -0
  52. data/test/serializers/attributes_test.rb +28 -0
  53. data/test/serializers/cache_test.rb +128 -0
  54. data/test/serializers/configuration_test.rb +15 -0
  55. data/test/serializers/fieldset_test.rb +26 -0
  56. data/test/serializers/generators_test.rb +59 -0
  57. data/test/serializers/meta_test.rb +78 -0
  58. data/test/serializers/options_test.rb +21 -0
  59. data/test/serializers/serializer_for_test.rb +56 -0
  60. data/test/serializers/urls_test.rb +26 -0
  61. data/test/test_helper.rb +21 -6
  62. metadata +121 -159
  63. data/DESIGN.textile +0 -586
  64. data/lib/action_controller/serialization_test_case.rb +0 -79
  65. data/lib/active_model/array_serializer.rb +0 -68
  66. data/lib/active_model/default_serializer.rb +0 -28
  67. data/lib/active_model/serializable/utils.rb +0 -16
  68. data/lib/active_model/serializable.rb +0 -59
  69. data/lib/active_model/serializer/association/has_many.rb +0 -39
  70. data/lib/active_model/serializer/association/has_one.rb +0 -25
  71. data/lib/active_model/serializer/association.rb +0 -58
  72. data/lib/active_model/serializer/config.rb +0 -31
  73. data/lib/active_model/serializer/generators/resource_override.rb +0 -13
  74. data/lib/active_model/serializer/generators/serializer/USAGE +0 -9
  75. data/lib/active_model/serializer/generators/serializer/scaffold_controller_generator.rb +0 -14
  76. data/lib/active_model/serializer/generators/serializer/templates/controller.rb +0 -93
  77. data/lib/active_model/serializer/railtie.rb +0 -22
  78. data/lib/active_model/serializer_support.rb +0 -5
  79. data/lib/active_model_serializers/model/caching.rb +0 -26
  80. data/test/benchmark/app.rb +0 -60
  81. data/test/benchmark/benchmarking_support.rb +0 -67
  82. data/test/benchmark/bm_active_record.rb +0 -41
  83. data/test/benchmark/setup.rb +0 -75
  84. data/test/benchmark/tmp/miniprofiler/mp_timers_6eqewtfgrhitvq5gqm25 +0 -0
  85. data/test/benchmark/tmp/miniprofiler/mp_timers_8083sx03hu72pxz1a4d0 +0 -0
  86. data/test/benchmark/tmp/miniprofiler/mp_timers_fyz2gsml4z0ph9kpoy1c +0 -0
  87. data/test/benchmark/tmp/miniprofiler/mp_timers_hjry5rc32imd42oxoi48 +0 -0
  88. data/test/benchmark/tmp/miniprofiler/mp_timers_m8fpoz2cvt3g9agz0bs3 +0 -0
  89. data/test/benchmark/tmp/miniprofiler/mp_timers_p92m2drnj1i568u3sta0 +0 -0
  90. data/test/benchmark/tmp/miniprofiler/mp_timers_qg52tpca3uesdfguee9i +0 -0
  91. data/test/benchmark/tmp/miniprofiler/mp_timers_s15t1a6mvxe0z7vjv790 +0 -0
  92. data/test/benchmark/tmp/miniprofiler/mp_timers_x8kal3d17nfds6vp4kcj +0 -0
  93. data/test/benchmark/tmp/miniprofiler/mp_views_127.0.0.1 +0 -0
  94. data/test/fixtures/active_record.rb +0 -96
  95. data/test/fixtures/template.html.erb +0 -1
  96. data/test/integration/action_controller/namespaced_serialization_test.rb +0 -105
  97. data/test/integration/action_controller/serialization_test.rb +0 -287
  98. data/test/integration/action_controller/serialization_test_case_test.rb +0 -71
  99. data/test/integration/active_record/active_record_test.rb +0 -94
  100. data/test/integration/generators/resource_generator_test.rb +0 -26
  101. data/test/integration/generators/scaffold_controller_generator_test.rb +0 -64
  102. data/test/integration/generators/serializer_generator_test.rb +0 -41
  103. data/test/test_app.rb +0 -14
  104. data/test/tmp/app/assets/javascripts/accounts.js +0 -2
  105. data/test/tmp/app/assets/stylesheets/accounts.css +0 -4
  106. data/test/tmp/app/controllers/accounts_controller.rb +0 -3
  107. data/test/tmp/app/helpers/accounts_helper.rb +0 -3
  108. data/test/tmp/app/serializers/account_serializer.rb +0 -4
  109. data/test/tmp/config/routes.rb +0 -2
  110. data/test/unit/active_model/array_serializer/except_test.rb +0 -18
  111. data/test/unit/active_model/array_serializer/key_format_test.rb +0 -18
  112. data/test/unit/active_model/array_serializer/meta_test.rb +0 -53
  113. data/test/unit/active_model/array_serializer/only_test.rb +0 -18
  114. data/test/unit/active_model/array_serializer/options_test.rb +0 -16
  115. data/test/unit/active_model/array_serializer/root_test.rb +0 -102
  116. data/test/unit/active_model/array_serializer/scope_test.rb +0 -24
  117. data/test/unit/active_model/array_serializer/serialization_test.rb +0 -239
  118. data/test/unit/active_model/default_serializer_test.rb +0 -13
  119. data/test/unit/active_model/serializer/associations/build_serializer_test.rb +0 -36
  120. data/test/unit/active_model/serializer/associations_test.rb +0 -49
  121. data/test/unit/active_model/serializer/attributes_test.rb +0 -57
  122. data/test/unit/active_model/serializer/config_test.rb +0 -91
  123. data/test/unit/active_model/serializer/filter_test.rb +0 -69
  124. data/test/unit/active_model/serializer/has_many_polymorphic_test.rb +0 -189
  125. data/test/unit/active_model/serializer/has_many_test.rb +0 -265
  126. data/test/unit/active_model/serializer/has_one_and_has_many_test.rb +0 -27
  127. data/test/unit/active_model/serializer/has_one_polymorphic_test.rb +0 -196
  128. data/test/unit/active_model/serializer/has_one_test.rb +0 -253
  129. data/test/unit/active_model/serializer/key_format_test.rb +0 -25
  130. data/test/unit/active_model/serializer/meta_test.rb +0 -39
  131. data/test/unit/active_model/serializer/options_test.rb +0 -42
  132. data/test/unit/active_model/serializer/root_test.rb +0 -117
  133. data/test/unit/active_model/serializer/scope_test.rb +0 -49
  134. data/test/unit/active_model/serializer/url_helpers_test.rb +0 -35
  135. data/test/unit/active_model/serilizable_test.rb +0 -50
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA256:
3
- metadata.gz: 52331f8ebc5267f272b9823aca4573af1f8a3493ff31ab42255a62003ec21c7e
4
- data.tar.gz: c050584bb445c216b604b33ea421c5705e0a7a35842d609edf2b2ce87f0facf5
2
+ SHA1:
3
+ metadata.gz: e77127a346e9bfdfb4b48152c333394b5c5e2e41
4
+ data.tar.gz: cc4ba7acbb64a83d588e6da78c54ace9e9309734
5
5
  SHA512:
6
- metadata.gz: 7f1799ea050b2e12bc6ea3ca43b121801a0b33858ad3ad2e3b503d940a0439ceb83ab596d53e9cb46bc85dc25e92af8350d0f54db6eea51cb867a8bb475766dc
7
- data.tar.gz: 6c0d80acada0ae9f37638fe5ca5a95a23c43faaafba1f6474a6f337f2faadca92b587f5c83dbbe1b6ecbd38169e334940ed685dfcd88cf9c44bd7d9887667e04
6
+ metadata.gz: fca71a58180a630765a4628c9202b775fb855c36d517546a6fa122166944cd14d79e968369d7fdabce45c6bd585b55a3e9c17ccd72b8b1287fe8eff0b8507167
7
+ data.tar.gz: dafdf5f8c3f57bdbaf141d05573459bc14f314a0a5bc6a30f94eb8f8d6f2e8d29649ba34187112c27c819536dd77a7983715b066c83283ef1434a8ea333669ff
data/.gitignore ADDED
@@ -0,0 +1,21 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ Vagrantfile
14
+ .vagrant
15
+ rdoc
16
+ spec/reports
17
+ test/tmp
18
+ test/version_tmp
19
+ tmp
20
+ *.swp
21
+ .ruby-version
data/.travis.yml ADDED
@@ -0,0 +1,27 @@
1
+ language: ruby
2
+
3
+ sudo: false
4
+
5
+ rvm:
6
+ - 1.9.3
7
+ - 2.0.0
8
+ - 2.1
9
+ - 2.2
10
+ - jruby-19mode
11
+ - rbx-2
12
+ - ruby-head
13
+
14
+ install:
15
+ - bundle install --retry=3
16
+
17
+ env:
18
+ - "RAILS_VERSION=3.2"
19
+ - "RAILS_VERSION=4.0"
20
+ - "RAILS_VERSION=4.1"
21
+ - "RAILS_VERSION=master"
22
+
23
+ matrix:
24
+ allow_failures:
25
+ - rvm: ruby-head
26
+ - env: "RAILS_VERSION=master"
27
+ - env: "RAILS_VERSION=3.2"
data/CHANGELOG.md CHANGED
@@ -1,204 +1,8 @@
1
- ## 0.09.x
2
-
3
- ### [0-9-stable](https://github.com/rails-api/active_model_serializers/compare/v0.9.9...0-9-stable)
4
-
5
- ### [v0.9.9 (2023-05-18)](https://github.com/rails-api/active_model_serializers/compare/v0.9.8...v0.9.8)
6
-
7
- - [#2446](https://github.com/rails-api/active_model_serializers/pull/2446) Fix Ruby > 2.5 constant lookup. (@Physium)
8
-
9
- ### [v0.9.8 (2020-12-10)](https://github.com/rails-api/active_model_serializers/compare/v0.9.7...v0.9.8)
10
-
11
- - [#2373](https://github.com/rails-api/active_model_serializers/pull/2373) Fix Rails 6.0 deprecation warnings. (@supremebeing7)
12
-
13
- ### [v0.9.7 (2017-05-01)](https://github.com/rails-api/active_model_serializers/compare/v0.9.6...v0.9.7)
14
-
15
- - [#2080](https://github.com/rails-api/active_model_serializers/pull/2080) remove `{ payload: nil }` from `!serialize.active_model_serializers` ActiveSupport::Notification. `payload` never had a value. Changes, for example `{ serializer: 'ActiveModel::DefaultSerializer', payload: nil }` to be `{ serializer: 'ActiveModel::DefaultSerializer' }` (@yosiat)
16
-
17
- ### [v0.9.6 (2017-01-10)](https://github.com/rails-api/active_model_serializers/compare/v0.9.5...v0.9.6)
18
-
19
- - [#2008](https://github.com/rails-api/active_model_serializers/pull/2008) Fix warning on Thor. (@kirs)
20
-
21
- ### [v0.9.5 (2016-03-30)](https://github.com/rails-api/active_model_serializers/compare/v0.9.4...v0.9.5)
22
-
23
- - [#1607](https://github.com/rails-api/active_model_serializers/pull/1607) Merge multiple nested associations. (@Hirtenknogger)
24
-
25
- ### [v0.9.4 (2016-01-05)](https://github.com/rails-api/active_model_serializers/compare/v0.9.3...v0.9.4)
26
-
27
- - [#752](https://github.com/rails-api/active_model_serializers/pull/752) Tiny improvement of README 0-9-stable (@basiam)
28
- - [#749](https://github.com/rails-api/active_model_serializers/pull/749) remove trailing whitespace (@shwoodard)
29
- - [#717](https://github.com/rails-api/active_model_serializers/pull/717) fixed issue with rendering Hash which appears in rails 4.2.0.beta4 (@kurko, @greshny)
30
- - [#790](https://github.com/rails-api/active_model_serializers/pull/790) pass context to ArraySerializer (@lanej)
31
- - [#797](https://github.com/rails-api/active_model_serializers/pull/797) Fix and test for #490 (@afn)
32
- - [#813](https://github.com/rails-api/active_model_serializers/pull/813) Allow to define custom serializer for given class (@jtomaszewski)
33
- - [#841](https://github.com/rails-api/active_model_serializers/pull/841) Fix issue with embedding multiple associations under the same root key (@antstorm)
34
- - [#748](https://github.com/rails-api/active_model_serializers/pull/748) Propagate serialization_options across associations (@raphaelpereira)
35
-
36
- ### [v0.9.3 (2015/01/21 20:29 +00:00)](https://github.com/rails-api/active_model_serializers/compare/v0.9.2...v0.9.3)
37
-
38
- Features:
39
- - [#774](https://github.com/rails-api/active_model_serializers/pull/774) Fix nested include attributes (@nhocki)
40
- - [#771](https://github.com/rails-api/active_model_serializers/pull/771) Make linked resource type names consistent with root names (@sweatypitts)
41
- - [#696](https://github.com/rails-api/active_model_serializers/pull/696) Explicitly set serializer for associations (@ggordon)
42
- - [#700](https://github.com/rails-api/active_model_serializers/pull/700) sparse fieldsets (@arenoir)
43
- - [#768](https://github.com/rails-api/active_model_serializers/pull/768) Adds support for `meta` and `meta_key` attribute (@kurko)
44
-
45
- ### [v0.9.2](https://github.com/rails-api/active_model_serializers/compare/v0.9.1...v0.9.2)
46
-
47
- ### [v0.9.1 (2014/12/04 11:54 +00:00)](https://github.com/rails-api/active_model_serializers/compare/v0.9.0...v0.9.1)
48
-
49
- - [#707](https://github.com/rails-api/active_model_serializers/pull/707) A Friendly Note on Which AMS Version to Use (@jherdman)
50
- - [#730](https://github.com/rails-api/active_model_serializers/pull/730) Fixes nested has_many links in JSONAPI (@kurko)
51
- - [#718](https://github.com/rails-api/active_model_serializers/pull/718) Allow overriding the adapter with render option (@ggordon)
52
- - [#720](https://github.com/rails-api/active_model_serializers/pull/720) Rename attribute with :key (0.8.x compatibility) (@ggordon)
53
- - [#728](https://github.com/rails-api/active_model_serializers/pull/728) Use type as key for linked resources (@kurko)
54
- - [#729](https://github.com/rails-api/active_model_serializers/pull/729) Use the new beta build env on Travis (@joshk)
55
- - [#703](https://github.com/rails-api/active_model_serializers/pull/703) Support serializer and each_serializer options in renderer (@ggordon, @mieko)
56
- - [#727](https://github.com/rails-api/active_model_serializers/pull/727) Includes links inside of linked resources (@kurko)
57
- - [#726](https://github.com/rails-api/active_model_serializers/pull/726) Bugfix: include nested has_many associations (@kurko)
58
- - [#722](https://github.com/rails-api/active_model_serializers/pull/722) Fix infinite recursion (@ggordon)
59
- - [#1](https://github.com/rails-api/active_model_serializers/pull/1) Allow for the implicit use of ArraySerializer when :each_serializer is specified (@mieko)
60
- - [#692](https://github.com/rails-api/active_model_serializers/pull/692) Include 'linked' member for json-api collections (@ggordon)
61
- - [#714](https://github.com/rails-api/active_model_serializers/pull/714) Define as_json instead of to_json (@guilleiguaran)
62
- - [#710](https://github.com/rails-api/active_model_serializers/pull/710) JSON-API: Don't include linked section if associations are empty (@guilleiguaran)
63
- - [#711](https://github.com/rails-api/active_model_serializers/pull/711) Fixes rbx gems bundling on TravisCI (@kurko)
64
- - [#709](https://github.com/rails-api/active_model_serializers/pull/709) Add type key when association name is different than object type (@guilleiguaran)
65
- - [#708](https://github.com/rails-api/active_model_serializers/pull/708) Handle correctly null associations (@guilleiguaran)
66
- - [#691](https://github.com/rails-api/active_model_serializers/pull/691) Fix embed option for associations (@jacob-s-son)
67
- - [#689](https://github.com/rails-api/active_model_serializers/pull/689) Fix support for custom root in JSON-API adapter (@guilleiguaran)
68
- - [#685](https://github.com/rails-api/active_model_serializers/pull/685) Serialize ids as strings in JSON-API adapter (@guilleiguaran)
69
- - [#684](https://github.com/rails-api/active_model_serializers/pull/684) Refactor adapters to implement support for array serialization (@guilleiguaran)
70
- - [#682](https://github.com/rails-api/active_model_serializers/pull/682) Include root by default in JSON-API serializers (@guilleiguaran)
71
- - [#625](https://github.com/rails-api/active_model_serializers/pull/625) Add DSL for urls (@JordanFaust)
72
- - [#677](https://github.com/rails-api/active_model_serializers/pull/677) Add support for embed: :ids option for in associations (@guilleiguaran)
73
- - [#681](https://github.com/rails-api/active_model_serializers/pull/681) Check superclasses for Serializers (@quainjn)
74
- - [#680](https://github.com/rails-api/active_model_serializers/pull/680) Add support for root keys (@NullVoxPopuli)
75
- - [#675](https://github.com/rails-api/active_model_serializers/pull/675) Support Rails 4.2.0 (@tricknotes)
76
- - [#667](https://github.com/rails-api/active_model_serializers/pull/667) Require only activemodel instead of full rails (@guilleiguaran)
77
- - [#653](https://github.com/rails-api/active_model_serializers/pull/653) Add "_test" suffix to JsonApi::HasManyTest filename. (@alexgenco)
78
- - [#631](https://github.com/rails-api/active_model_serializers/pull/631) Update build badge URL (@craiglittle)
79
-
80
- ### [v0.9.0](https://github.com/rails-api/active_model_serializers/compare/v0.9.0.alpha1...v0.9.0)
81
-
82
- ### [0.9.0.alpha1 - January 7, 2014](https://github.com/rails-api/active_model_serializers/compare/d72b66d4c...v0.9.0.alpha1)
83
-
84
- ### 0.9.0.pre
85
-
86
- * The following methods were removed
87
- - Model#active\_model\_serializer
88
- - Serializer#include!
89
- - Serializer#include?
90
- - Serializer#attr\_disabled=
91
- - Serializer#cache
92
- - Serializer#perform\_caching
93
- - Serializer#schema (needs more discussion)
94
- - Serializer#attribute
95
- - Serializer#include\_#{name}? (filter method added)
96
- - Serializer#attributes (took a hash)
97
-
98
- * The following things were added
99
- - Serializer#filter method
100
- - CONFIG object
101
-
102
- * Remove support for ruby 1.8 versions.
103
-
104
- * Require rails >= 3.2.
105
-
106
- * Serializers for associations are being looked up in a parent serializer's namespace first. Same with controllers' namespaces.
107
-
108
- * Added a "prefix" option in case you want to use a different version of serializer.
109
-
110
- * Serializers default namespace can be set in `default_serializer_options` and inherited by associations.
111
-
112
- # VERSION 0.9.0.pre
113
-
114
- * The following methods were removed
115
- - Model#active\_model\_serializer
116
- - Serializer#include!
117
- - Serializer#include?
118
- - Serializer#attr\_disabled=
119
- - Serializer#cache
120
- - Serializer#perform\_caching
121
- - Serializer#schema (needs more discussion)
122
- - Serializer#attribute
123
- - Serializer#include\_#{name}? (filter method added)
124
- - Serializer#attributes (took a hash)
125
-
126
- * The following things were added
127
- - Serializer#filter method
128
- - CONFIG object
129
-
130
- * Remove support for ruby 1.8 versions.
131
-
132
- * Require rails >= 3.2.
133
-
134
- * Serializers for associations are being looked up in a parent serializer's namespace first. Same with controllers' namespaces.
135
-
136
- * Added a "prefix" option in case you want to use a different version of serializer.
137
-
138
- * Serializers default namespace can be set in `default_serializer_options` and inherited by associations.
139
-
140
- # VERSION 0.8.1
141
-
142
- * Fix bug whereby a serializer using 'options' would blow up.
143
-
144
- # VERSION 0.8.0
145
-
146
- * Attributes can now have optional types.
147
-
148
- * A new DefaultSerializer ensures that POROs behave the same way as ActiveModels.
149
-
150
- * If you wish to override ActiveRecord::Base#to\_Json, you can now require
151
- 'active\_record/serializer\_override'. We don't recommend you do this, but
152
- many users do, so we've left it optional.
153
-
154
- * Fixed a bug where ActionController wouldn't always have MimeResponds.
155
-
156
- * An optional caching feature allows you to cache JSON & hashes that AMS uses.
157
- Adding 'cached true' to your Serializers will turn on this cache.
158
-
159
- * URL helpers used inside of Engines now work properly.
160
-
161
- * Serializers now can filter attributes with `only` and `except`:
162
-
163
- ```
164
- UserSerializer.new(user, only: [:first_name, :last_name])
165
- UserSerializer.new(user, except: :first_name)
166
- ```
167
-
168
- * Basic Mongoid support. We now include our mixins in the right place.
169
-
170
- * On Ruby 1.8, we now generate an `id` method that properly serializes `id`
171
- columns. See issue #127 for more.
172
-
173
- * Add an alias for `scope` method to be the name of the context. By default
174
- this is `current_user`. The name is automatically set when using
175
- `serialization_scope` in the controller.
176
-
177
- * Pass through serialization options (such as `:include`) when a model
178
- has no serializer defined.
179
-
180
- # VERSION 0.7.0
181
-
182
- * ```embed_key``` option to allow embedding by attributes other than IDs
183
- * Fix rendering nil with custom serializer
184
- * Fix global ```self.root = false```
185
- * Add support for specifying the serializer for an association as a String
186
- * Able to specify keys on the attributes method
187
- * Serializer Reloading via ActiveSupport::DescendantsTracker
188
- * Reduce double map to once; Fixes datamapper eager loading.
189
-
190
- # VERSION 0.6.0
191
-
192
- * Serialize sets properly
193
- * Add root option to ArraySerializer
194
- * Support polymorphic associations
195
- * Support :each_serializer in ArraySerializer
196
- * Add `scope` method to easily access the scope in the serializer
197
- * Fix regression with Rails 3.2.6; add Rails 4 support
198
- * Allow serialization_scope to be disabled with serialization_scope nil
199
- * Array serializer should support pure ruby objects besides serializers
200
-
201
- # VERSION 0.5.0
202
-
203
- * First tagged version
204
- * Changes generators to always generate an ApplicationSerializer
1
+ ### 0.10.0
2
+
3
+ * adds support for `meta` and `meta_key` [@kurko]
4
+ * adds method to override association [adcb99e, @kurko]
5
+ * adds `has_one` attribute for backwards compatibility [@ggordon]
6
+ * updates JSON API support to RC3 [@mateomurphy]
7
+ * adds fragment cache support [@joaomdmoura]
8
+ * adds cache support to attributes and associations [@joaomdmoura]
data/CONTRIBUTING.md CHANGED
@@ -1,20 +1,31 @@
1
- Contributing to AMS
2
- ===================
1
+ ## How can I help?
3
2
 
4
- First of all, **thank you**!
3
+ Everyone is encouraged to open issues that are affecting you: bugs, ideas, performance problems – everything helps!
5
4
 
6
- Now, for the details:
5
+ The first place to start is by looking at our [GitHub Issues](https://github.com/rails-api/active_model_serializers/issues).
7
6
 
8
- Please file issues on the [GitHub Issues
9
- list](https://github.com/rails-api/active_model_serializers/issues).
7
+ The vast majority of development is happening under the `master` branch, currently slated for release as `0.10.x`. This is where we would suggest you start.
10
8
 
11
- Please discuss new features or ask for feedback about a new feature [on
12
- rails-api-core](https://groups.google.com/forum/#!forum/rails-api-core).
9
+ Fixing bugs is extraordinarily helpful and requires the least familiarity with AMS. Look for issues labeled [**Needs Bug Verification**](https://github.com/rails-api/active_model_serializers/labels/Needs%20Bug%20Verification) and [**Bug**](https://github.com/rails-api/active_model_serializers/labels/bug).
13
10
 
14
- If you want a feature implemented, the best way to get it done is to submit a
15
- pull request that implements it. Tests and docs would be nice.
11
+ We are also actively working to identify tasks under the label [**Good for New Contributors**](https://github.com/rails-api/active_model_serializers/labels/Good%20for%20New%20Contributors). Some bugs are expressly not good for new contributors, so don't expect 100% overlap between the two.
16
12
 
17
- Please include a CHANGELOG with all entries that change behavior.
13
+ If you want to work on new feature development, look for the label [**Feature**](https://github.com/rails-api/active_model_serializers/labels/Feature).
18
14
 
19
- :heart: :sparkling_heart: :heart:
15
+ We are also encouraging comments to substantial changes (larger than bugfixes and simple features) under an "RFC" (Request for Comments) process before we start active development. Look for the [**RFC**](https://github.com/rails-api/active_model_serializers/labels/RFC) label.
20
16
 
17
+ ## Issue Labeling
18
+
19
+ AMS uses a subset of [StandardIssueLabels](https://github.com/wagenet/StandardIssueLabels) for Github Issues. You can [see our labels here](https://github.com/rails-api/active_model_serializers/labels).
20
+
21
+ ## Contributing
22
+
23
+ 1. Fork it ( https://github.com/rails-api/active_model_serializers/fork )
24
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
25
+ 3. Write tests for your feature, or regression tests highlighting a bug
26
+ 4. Write the feature itself, or fix your bug
27
+ 5. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 6. Push to the branch (`git push origin my-new-feature`)
29
+ 7. Create a new Pull Request
30
+
31
+ Remember to squash your commits and rebase off `master`.
data/Gemfile ADDED
@@ -0,0 +1,17 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in active_model_serializers.gemspec
4
+ gemspec
5
+
6
+ gem "minitest"
7
+
8
+ version = ENV["RAILS_VERSION"] || "4.1"
9
+
10
+ if version == "master"
11
+ gem "rails", github: "rails/rails"
12
+
13
+ # ugh https://github.com/rails/rails/issues/16063#issuecomment-48090125
14
+ gem "arel", github: "rails/arel"
15
+ else
16
+ gem "rails", "~> #{version}.0"
17
+ end
@@ -1,4 +1,6 @@
1
- Copyright (c) 2011-2012 José Valim & Yehuda Katz
1
+ Copyright (c) 2014 Steve Klabnik
2
+
3
+ MIT License
2
4
 
3
5
  Permission is hereby granted, free of charge, to any person obtaining
4
6
  a copy of this software and associated documentation files (the
@@ -18,4 +20,3 @@ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
20
  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
21
  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
22
  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
-