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