active_model_serializers 0.9.12 → 0.10.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (134) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +21 -0
  3. data/.travis.yml +27 -0
  4. data/CHANGELOG.md +8 -231
  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 -84
  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 -3
  23. data/lib/active_model/serializer.rb +192 -263
  24. data/lib/active_model_serializers.rb +5 -19
  25. data/lib/generators/serializer/USAGE +6 -0
  26. data/lib/{active_model/serializer/generators → generators}/serializer/serializer_generator.rb +8 -10
  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 -172
  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 +20 -10
  62. metadata +121 -158
  63. data/DESIGN.textile +0 -586
  64. data/lib/action_controller/serialization_test_case.rb +0 -82
  65. data/lib/active_model/array_serializer.rb +0 -70
  66. data/lib/active_model/default_serializer.rb +0 -30
  67. data/lib/active_model/serializable/utils.rb +0 -18
  68. data/lib/active_model/serializable.rb +0 -61
  69. data/lib/active_model/serializer/association/has_many.rb +0 -41
  70. data/lib/active_model/serializer/association/has_one.rb +0 -27
  71. data/lib/active_model/serializer/association.rb +0 -58
  72. data/lib/active_model/serializer/config.rb +0 -33
  73. data/lib/active_model/serializer/generators/resource_override.rb +0 -15
  74. data/lib/active_model/serializer/generators/serializer/USAGE +0 -9
  75. data/lib/active_model/serializer/generators/serializer/scaffold_controller_generator.rb +0 -16
  76. data/lib/active_model/serializer/generators/serializer/templates/controller.rb +0 -93
  77. data/lib/active_model/serializer/railtie.rb +0 -24
  78. data/lib/active_model/serializer_support.rb +0 -7
  79. data/test/benchmark/app.rb +0 -60
  80. data/test/benchmark/benchmarking_support.rb +0 -67
  81. data/test/benchmark/bm_active_record.rb +0 -41
  82. data/test/benchmark/setup.rb +0 -75
  83. data/test/benchmark/tmp/miniprofiler/mp_timers_6eqewtfgrhitvq5gqm25 +0 -0
  84. data/test/benchmark/tmp/miniprofiler/mp_timers_8083sx03hu72pxz1a4d0 +0 -0
  85. data/test/benchmark/tmp/miniprofiler/mp_timers_fyz2gsml4z0ph9kpoy1c +0 -0
  86. data/test/benchmark/tmp/miniprofiler/mp_timers_hjry5rc32imd42oxoi48 +0 -0
  87. data/test/benchmark/tmp/miniprofiler/mp_timers_m8fpoz2cvt3g9agz0bs3 +0 -0
  88. data/test/benchmark/tmp/miniprofiler/mp_timers_p92m2drnj1i568u3sta0 +0 -0
  89. data/test/benchmark/tmp/miniprofiler/mp_timers_qg52tpca3uesdfguee9i +0 -0
  90. data/test/benchmark/tmp/miniprofiler/mp_timers_s15t1a6mvxe0z7vjv790 +0 -0
  91. data/test/benchmark/tmp/miniprofiler/mp_timers_x8kal3d17nfds6vp4kcj +0 -0
  92. data/test/benchmark/tmp/miniprofiler/mp_views_127.0.0.1 +0 -0
  93. data/test/fixtures/active_record.rb +0 -96
  94. data/test/fixtures/template.html.erb +0 -1
  95. data/test/integration/action_controller/namespaced_serialization_test.rb +0 -105
  96. data/test/integration/action_controller/serialization_test.rb +0 -287
  97. data/test/integration/action_controller/serialization_test_case_test.rb +0 -71
  98. data/test/integration/active_record/active_record_test.rb +0 -94
  99. data/test/integration/generators/resource_generator_test.rb +0 -26
  100. data/test/integration/generators/scaffold_controller_generator_test.rb +0 -64
  101. data/test/integration/generators/serializer_generator_test.rb +0 -41
  102. data/test/test_app.rb +0 -18
  103. data/test/tmp/app/assets/javascripts/accounts.js +0 -2
  104. data/test/tmp/app/assets/stylesheets/accounts.css +0 -4
  105. data/test/tmp/app/controllers/accounts_controller.rb +0 -3
  106. data/test/tmp/app/helpers/accounts_helper.rb +0 -3
  107. data/test/tmp/app/serializers/account_serializer.rb +0 -4
  108. data/test/tmp/config/routes.rb +0 -2
  109. data/test/unit/active_model/array_serializer/except_test.rb +0 -18
  110. data/test/unit/active_model/array_serializer/key_format_test.rb +0 -18
  111. data/test/unit/active_model/array_serializer/meta_test.rb +0 -53
  112. data/test/unit/active_model/array_serializer/only_test.rb +0 -18
  113. data/test/unit/active_model/array_serializer/options_test.rb +0 -16
  114. data/test/unit/active_model/array_serializer/root_test.rb +0 -102
  115. data/test/unit/active_model/array_serializer/scope_test.rb +0 -24
  116. data/test/unit/active_model/array_serializer/serialization_test.rb +0 -239
  117. data/test/unit/active_model/default_serializer_test.rb +0 -13
  118. data/test/unit/active_model/serializer/associations/build_serializer_test.rb +0 -36
  119. data/test/unit/active_model/serializer/associations_test.rb +0 -49
  120. data/test/unit/active_model/serializer/attributes_test.rb +0 -57
  121. data/test/unit/active_model/serializer/config_test.rb +0 -91
  122. data/test/unit/active_model/serializer/filter_test.rb +0 -69
  123. data/test/unit/active_model/serializer/has_many_polymorphic_test.rb +0 -189
  124. data/test/unit/active_model/serializer/has_many_test.rb +0 -265
  125. data/test/unit/active_model/serializer/has_one_and_has_many_test.rb +0 -27
  126. data/test/unit/active_model/serializer/has_one_polymorphic_test.rb +0 -196
  127. data/test/unit/active_model/serializer/has_one_test.rb +0 -253
  128. data/test/unit/active_model/serializer/key_format_test.rb +0 -25
  129. data/test/unit/active_model/serializer/meta_test.rb +0 -39
  130. data/test/unit/active_model/serializer/options_test.rb +0 -42
  131. data/test/unit/active_model/serializer/root_test.rb +0 -117
  132. data/test/unit/active_model/serializer/scope_test.rb +0 -49
  133. data/test/unit/active_model/serializer/url_helpers_test.rb +0 -36
  134. data/test/unit/active_model/serilizable_test.rb +0 -50
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA256:
3
- metadata.gz: 61778c5b2b91da210dcc01075ef454249315c36600f82bea6996ed3290560003
4
- data.tar.gz: 75e07b2aaf633ea4c5b785ea9d95a23bf9a240e8ee232c80a2c2a8bc9bca4666
2
+ SHA1:
3
+ metadata.gz: e77127a346e9bfdfb4b48152c333394b5c5e2e41
4
+ data.tar.gz: cc4ba7acbb64a83d588e6da78c54ace9e9309734
5
5
  SHA512:
6
- metadata.gz: dd16f19a2585c7fb2fdb4b54990eb71e306def01fc6757d42c19b26820f43d3afb82d28c44efd6c228bffcac7a84324277e9d17facaa22935bf8f3a1cf4ee588
7
- data.tar.gz: 06c780dffd320606869b1e377e08fdbc2b83f7ec2726ea100d3004e9ad7098f89d254ffb2b1b62477a08b0e6898b1a40ae0466bf137296559e3736c19ab7a760
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,231 +1,8 @@
1
- ## 0.09.x
2
-
3
- ### [0-9-stable](https://github.com/rails-api/active_model_serializers/compare/v0.9.12...0-9-stable)
4
-
5
- ### [v0.9.12 (2024-04-11)](https://github.com/rails-api/active_model_serializers/compare/v0.9.11...v0.9.12)
6
-
7
- - Fix
8
- - [#2468](https://github.com/rails-api/active_model_serializers/pull/2468) Fix bug introduced in v0.9.9. Revert "Allow serializer_for to accept String instead of just class objects". (@byroot)
9
- - Perf
10
- - [#2466](https://github.com/rails-api/active_model_serializers/pull/2466) Prefer `defined?` to `Object.constants.include?` (@byroot)
11
- - [#2467](https://github.com/rails-api/active_model_serializers/pull/2467) Lazily compute possible serializer class names (@byroot)
12
- - Chore
13
- - [#2469](https://github.com/rails-api/active_model_serializers/pull/2469) Fix various warnings in the test suite (@byroot)
14
-
15
- ### [v0.9.11 (2024-04-09)](https://github.com/rails-api/active_model_serializers/compare/v0.9.10...v0.9.11)
16
-
17
- v0.9.10 was built with an extra file included and so was yanked.
18
- v0.9.11 is the same as v0.9.10 but doesn't have the extra file.
19
-
20
- ### [v0.9.10 (2024-04-09)](https://github.com/rails-api/active_model_serializers/compare/v0.9.9...v0.9.10)
21
-
22
- - Fix
23
- - [#2464](https://github.com/rails-api/active_model_serializers/pull/2464) Do not load ActionController::TestCase in production (@byroot)
24
- - Perf
25
- - [#2465](https://github.com/rails-api/active_model_serializers/pull/2465) Make compatible with enable-frozen-string-literal (@byroot)
26
- - [#2463](https://github.com/rails-api/active_model_serializers/pull/2463) Shape Friendly ActionController:Serialization (@byroot)
27
- - Chore
28
- - [#2462](https://github.com/rails-api/active_model_serializers/pull/2462]) Rails 7.1, Ruby 3.3 compat (@byroot)
29
- - Test
30
- - [#2447](https://github.com/rails-api/active_model_serializers/pull/2447) Configure CI on GitHub actoins (@Physium)
31
-
32
- ### [v0.9.9 (2023-05-18)](https://github.com/rails-api/active_model_serializers/compare/v0.9.8...v0.9.8)
33
-
34
- - [#2446](https://github.com/rails-api/active_model_serializers/pull/2446) Fix Ruby > 2.5 constant lookup. (@Physium)
35
-
36
- ### [v0.9.8 (2020-12-10)](https://github.com/rails-api/active_model_serializers/compare/v0.9.7...v0.9.8)
37
-
38
- - [#2373](https://github.com/rails-api/active_model_serializers/pull/2373) Fix Rails 6.0 deprecation warnings. (@supremebeing7)
39
-
40
- ### [v0.9.7 (2017-05-01)](https://github.com/rails-api/active_model_serializers/compare/v0.9.6...v0.9.7)
41
-
42
- - [#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)
43
-
44
- ### [v0.9.6 (2017-01-10)](https://github.com/rails-api/active_model_serializers/compare/v0.9.5...v0.9.6)
45
-
46
- - [#2008](https://github.com/rails-api/active_model_serializers/pull/2008) Fix warning on Thor. (@kirs)
47
-
48
- ### [v0.9.5 (2016-03-30)](https://github.com/rails-api/active_model_serializers/compare/v0.9.4...v0.9.5)
49
-
50
- - [#1607](https://github.com/rails-api/active_model_serializers/pull/1607) Merge multiple nested associations. (@Hirtenknogger)
51
-
52
- ### [v0.9.4 (2016-01-05)](https://github.com/rails-api/active_model_serializers/compare/v0.9.3...v0.9.4)
53
-
54
- - [#752](https://github.com/rails-api/active_model_serializers/pull/752) Tiny improvement of README 0-9-stable (@basiam)
55
- - [#749](https://github.com/rails-api/active_model_serializers/pull/749) remove trailing whitespace (@shwoodard)
56
- - [#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)
57
- - [#790](https://github.com/rails-api/active_model_serializers/pull/790) pass context to ArraySerializer (@lanej)
58
- - [#797](https://github.com/rails-api/active_model_serializers/pull/797) Fix and test for #490 (@afn)
59
- - [#813](https://github.com/rails-api/active_model_serializers/pull/813) Allow to define custom serializer for given class (@jtomaszewski)
60
- - [#841](https://github.com/rails-api/active_model_serializers/pull/841) Fix issue with embedding multiple associations under the same root key (@antstorm)
61
- - [#748](https://github.com/rails-api/active_model_serializers/pull/748) Propagate serialization_options across associations (@raphaelpereira)
62
-
63
- ### [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)
64
-
65
- Features:
66
- - [#774](https://github.com/rails-api/active_model_serializers/pull/774) Fix nested include attributes (@nhocki)
67
- - [#771](https://github.com/rails-api/active_model_serializers/pull/771) Make linked resource type names consistent with root names (@sweatypitts)
68
- - [#696](https://github.com/rails-api/active_model_serializers/pull/696) Explicitly set serializer for associations (@ggordon)
69
- - [#700](https://github.com/rails-api/active_model_serializers/pull/700) sparse fieldsets (@arenoir)
70
- - [#768](https://github.com/rails-api/active_model_serializers/pull/768) Adds support for `meta` and `meta_key` attribute (@kurko)
71
-
72
- ### [v0.9.2](https://github.com/rails-api/active_model_serializers/compare/v0.9.1...v0.9.2)
73
-
74
- ### [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)
75
-
76
- - [#707](https://github.com/rails-api/active_model_serializers/pull/707) A Friendly Note on Which AMS Version to Use (@jherdman)
77
- - [#730](https://github.com/rails-api/active_model_serializers/pull/730) Fixes nested has_many links in JSONAPI (@kurko)
78
- - [#718](https://github.com/rails-api/active_model_serializers/pull/718) Allow overriding the adapter with render option (@ggordon)
79
- - [#720](https://github.com/rails-api/active_model_serializers/pull/720) Rename attribute with :key (0.8.x compatibility) (@ggordon)
80
- - [#728](https://github.com/rails-api/active_model_serializers/pull/728) Use type as key for linked resources (@kurko)
81
- - [#729](https://github.com/rails-api/active_model_serializers/pull/729) Use the new beta build env on Travis (@joshk)
82
- - [#703](https://github.com/rails-api/active_model_serializers/pull/703) Support serializer and each_serializer options in renderer (@ggordon, @mieko)
83
- - [#727](https://github.com/rails-api/active_model_serializers/pull/727) Includes links inside of linked resources (@kurko)
84
- - [#726](https://github.com/rails-api/active_model_serializers/pull/726) Bugfix: include nested has_many associations (@kurko)
85
- - [#722](https://github.com/rails-api/active_model_serializers/pull/722) Fix infinite recursion (@ggordon)
86
- - [#1](https://github.com/rails-api/active_model_serializers/pull/1) Allow for the implicit use of ArraySerializer when :each_serializer is specified (@mieko)
87
- - [#692](https://github.com/rails-api/active_model_serializers/pull/692) Include 'linked' member for json-api collections (@ggordon)
88
- - [#714](https://github.com/rails-api/active_model_serializers/pull/714) Define as_json instead of to_json (@guilleiguaran)
89
- - [#710](https://github.com/rails-api/active_model_serializers/pull/710) JSON-API: Don't include linked section if associations are empty (@guilleiguaran)
90
- - [#711](https://github.com/rails-api/active_model_serializers/pull/711) Fixes rbx gems bundling on TravisCI (@kurko)
91
- - [#709](https://github.com/rails-api/active_model_serializers/pull/709) Add type key when association name is different than object type (@guilleiguaran)
92
- - [#708](https://github.com/rails-api/active_model_serializers/pull/708) Handle correctly null associations (@guilleiguaran)
93
- - [#691](https://github.com/rails-api/active_model_serializers/pull/691) Fix embed option for associations (@jacob-s-son)
94
- - [#689](https://github.com/rails-api/active_model_serializers/pull/689) Fix support for custom root in JSON-API adapter (@guilleiguaran)
95
- - [#685](https://github.com/rails-api/active_model_serializers/pull/685) Serialize ids as strings in JSON-API adapter (@guilleiguaran)
96
- - [#684](https://github.com/rails-api/active_model_serializers/pull/684) Refactor adapters to implement support for array serialization (@guilleiguaran)
97
- - [#682](https://github.com/rails-api/active_model_serializers/pull/682) Include root by default in JSON-API serializers (@guilleiguaran)
98
- - [#625](https://github.com/rails-api/active_model_serializers/pull/625) Add DSL for urls (@JordanFaust)
99
- - [#677](https://github.com/rails-api/active_model_serializers/pull/677) Add support for embed: :ids option for in associations (@guilleiguaran)
100
- - [#681](https://github.com/rails-api/active_model_serializers/pull/681) Check superclasses for Serializers (@quainjn)
101
- - [#680](https://github.com/rails-api/active_model_serializers/pull/680) Add support for root keys (@NullVoxPopuli)
102
- - [#675](https://github.com/rails-api/active_model_serializers/pull/675) Support Rails 4.2.0 (@tricknotes)
103
- - [#667](https://github.com/rails-api/active_model_serializers/pull/667) Require only activemodel instead of full rails (@guilleiguaran)
104
- - [#653](https://github.com/rails-api/active_model_serializers/pull/653) Add "_test" suffix to JsonApi::HasManyTest filename. (@alexgenco)
105
- - [#631](https://github.com/rails-api/active_model_serializers/pull/631) Update build badge URL (@craiglittle)
106
-
107
- ### [v0.9.0](https://github.com/rails-api/active_model_serializers/compare/v0.9.0.alpha1...v0.9.0)
108
-
109
- ### [0.9.0.alpha1 - January 7, 2014](https://github.com/rails-api/active_model_serializers/compare/d72b66d4c...v0.9.0.alpha1)
110
-
111
- ### 0.9.0.pre
112
-
113
- * The following methods were removed
114
- - Model#active\_model\_serializer
115
- - Serializer#include!
116
- - Serializer#include?
117
- - Serializer#attr\_disabled=
118
- - Serializer#cache
119
- - Serializer#perform\_caching
120
- - Serializer#schema (needs more discussion)
121
- - Serializer#attribute
122
- - Serializer#include\_#{name}? (filter method added)
123
- - Serializer#attributes (took a hash)
124
-
125
- * The following things were added
126
- - Serializer#filter method
127
- - CONFIG object
128
-
129
- * Remove support for ruby 1.8 versions.
130
-
131
- * Require rails >= 3.2.
132
-
133
- * Serializers for associations are being looked up in a parent serializer's namespace first. Same with controllers' namespaces.
134
-
135
- * Added a "prefix" option in case you want to use a different version of serializer.
136
-
137
- * Serializers default namespace can be set in `default_serializer_options` and inherited by associations.
138
-
139
- # VERSION 0.9.0.pre
140
-
141
- * The following methods were removed
142
- - Model#active\_model\_serializer
143
- - Serializer#include!
144
- - Serializer#include?
145
- - Serializer#attr\_disabled=
146
- - Serializer#cache
147
- - Serializer#perform\_caching
148
- - Serializer#schema (needs more discussion)
149
- - Serializer#attribute
150
- - Serializer#include\_#{name}? (filter method added)
151
- - Serializer#attributes (took a hash)
152
-
153
- * The following things were added
154
- - Serializer#filter method
155
- - CONFIG object
156
-
157
- * Remove support for ruby 1.8 versions.
158
-
159
- * Require rails >= 3.2.
160
-
161
- * Serializers for associations are being looked up in a parent serializer's namespace first. Same with controllers' namespaces.
162
-
163
- * Added a "prefix" option in case you want to use a different version of serializer.
164
-
165
- * Serializers default namespace can be set in `default_serializer_options` and inherited by associations.
166
-
167
- # VERSION 0.8.1
168
-
169
- * Fix bug whereby a serializer using 'options' would blow up.
170
-
171
- # VERSION 0.8.0
172
-
173
- * Attributes can now have optional types.
174
-
175
- * A new DefaultSerializer ensures that POROs behave the same way as ActiveModels.
176
-
177
- * If you wish to override ActiveRecord::Base#to\_Json, you can now require
178
- 'active\_record/serializer\_override'. We don't recommend you do this, but
179
- many users do, so we've left it optional.
180
-
181
- * Fixed a bug where ActionController wouldn't always have MimeResponds.
182
-
183
- * An optional caching feature allows you to cache JSON & hashes that AMS uses.
184
- Adding 'cached true' to your Serializers will turn on this cache.
185
-
186
- * URL helpers used inside of Engines now work properly.
187
-
188
- * Serializers now can filter attributes with `only` and `except`:
189
-
190
- ```
191
- UserSerializer.new(user, only: [:first_name, :last_name])
192
- UserSerializer.new(user, except: :first_name)
193
- ```
194
-
195
- * Basic Mongoid support. We now include our mixins in the right place.
196
-
197
- * On Ruby 1.8, we now generate an `id` method that properly serializes `id`
198
- columns. See issue #127 for more.
199
-
200
- * Add an alias for `scope` method to be the name of the context. By default
201
- this is `current_user`. The name is automatically set when using
202
- `serialization_scope` in the controller.
203
-
204
- * Pass through serialization options (such as `:include`) when a model
205
- has no serializer defined.
206
-
207
- # VERSION 0.7.0
208
-
209
- * ```embed_key``` option to allow embedding by attributes other than IDs
210
- * Fix rendering nil with custom serializer
211
- * Fix global ```self.root = false```
212
- * Add support for specifying the serializer for an association as a String
213
- * Able to specify keys on the attributes method
214
- * Serializer Reloading via ActiveSupport::DescendantsTracker
215
- * Reduce double map to once; Fixes datamapper eager loading.
216
-
217
- # VERSION 0.6.0
218
-
219
- * Serialize sets properly
220
- * Add root option to ArraySerializer
221
- * Support polymorphic associations
222
- * Support :each_serializer in ArraySerializer
223
- * Add `scope` method to easily access the scope in the serializer
224
- * Fix regression with Rails 3.2.6; add Rails 4 support
225
- * Allow serialization_scope to be disabled with serialization_scope nil
226
- * Array serializer should support pure ruby objects besides serializers
227
-
228
- # VERSION 0.5.0
229
-
230
- * First tagged version
231
- * 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
-