Commit Graph

349 Commits

Author SHA1 Message Date
Robin Daugherty
d39a99d770 Add serialization_options
Prior to 0.9, @options was used to see the options passed to to_json. For some reason, with 0.9 the options were no longer passed and were entirely inaccessible within a Serializer.

This restores the access by placing it in an attribute named serializer_options.
2014-10-12 01:08:47 -04:00
Steve Klabnik
5acd98e61b Merge pull request #639 from gauthier-delacroix/Unsuffixed-default-associations-keys
Allow JSONAPI unsuffixed associations keys
2014-10-08 14:45:46 -04:00
Steve Klabnik
06e3bb77f2 Merge pull request #662 from jastkand/remove-question-sign
Add auto-stripping of question mark for attributes
2014-09-26 10:35:43 -04:00
Andrey Krivko
bded293529 Add auto-stripping of question mark for attributes 2014-09-26 15:42:41 +07:00
Steve Klabnik
c19a254154 Merge pull request #632 from gauthier-delacroix/Default_namespace_inheritance
Default namespace option
2014-09-25 19:41:33 -04:00
Andrey Chernih
90343cea4d Make sure render json: ..., each_serializer: ... is working with Enumerables
If you try to render Enumerable with custom `each_serializer` then it will render with default serializer instead:

```ruby
render json: sequel_scope, each_serializer: CustomSerializer
```

This commit fixes this behaviour. Most likely fixes https://github.com/rails-api/active_model_serializers/issues/664 as well
2014-09-25 16:59:47 +04:00
Steve Klabnik
ff01ba2ced Merge pull request #647 from gauthier-delacroix/Fix-embed_in_root_key-merging
Fix embed_in_root_key merging
2014-09-20 17:45:45 -04:00
Gauthier Delacroix
efa22d9d44 Add plural_default_root config option 2014-09-12 18:56:51 +02:00
Gauthier Delacroix
a862929f81 Fix embed_in_root_key merging 2014-09-09 11:27:08 +02:00
Gauthier Delacroix
e273fc5854 Fix namespaced serializers reloading 2014-09-08 13:59:50 +02:00
Gauthier Delacroix
6f4f30cda6 Allow JSONAPI unsuffixed associations keys
As shown here :
https://github.com/json-api/json-api/blob/gh-pages/format/index.md#resource-relationships-
2014-09-05 18:46:08 +02:00
Gauthier Delacroix
8514528db7 Allow default namespace inheritance 2014-09-03 12:41:30 +02:00
Steve Klabnik
d40f0d67b9 Merge pull request #617 from konukhov/namespaced_serializers-0-9
Namespaced serializers #499
2014-08-31 20:00:47 -04:00
Steve Klabnik
f7f5e29358 Merge pull request #601 from radanskoric/fix-nested-embed-in-root
Fix for nested embed_in_root when serializer used as part of an association
2014-08-31 19:57:27 -04:00
Theodore Konukhov
0292940ab4 typo 2014-08-29 19:51:32 +02:00
Theodore Konukhov
095bae31d4 fix for ruby 1.9. 2014-08-29 19:38:53 +02:00
Theodore Konukhov
493041fdff sync with upstream 2014-08-29 06:28:13 +02:00
Theodore Konukhov
b297f17e53 test for namespaced associations + bug fixed 2014-08-29 06:11:40 +02:00
Theodore Konukhov
dde1492934 tests for namespaced controlleler 2014-08-26 18:07:31 +02:00
Pol Miro
26d5fb7423 Add support to polymorphic models 2014-08-25 23:32:09 -07:00
Pol Miro
e8b983490e Separate associations into multiple files 2014-08-25 23:32:09 -07:00
Theodore Konukhov
26c0847563 - If a controller is in a namespace, serializer will be looked up in this namespace first.
- Serializers for associations will be looked up in a parent serializer's namespace first too.
- "Prefix" option for different versions of associations serializers. Example: has_many :users, as: :short -> ShortUserSerializer

TODO: tests, config option for enabling namespace lookup
2014-08-24 15:57:24 +02:00
Radan Skoric
ddfd8d2c11 embed_in_root works even if serializer is invoked through another serializers' association which itself does not have embed_in_root set 2014-08-23 18:21:24 +02:00
Steve Klabnik
2fec5111ef Bump version to 0.9.0 2014-08-22 16:17:46 -04:00
Steve Klabnik
ae7959b76e Merge pull request #512 from TimPetricola/fix-options-access
Custom options are accessible in serializer
2014-08-22 16:15:41 -04:00
Steve Klabnik
74625f778b Merge pull request #594 from bolshakov/feature/custom_array_serializer
Support custom array serializer
2014-08-22 15:28:26 -04:00
Steve Klabnik
e9378cc9ab Merge pull request #595 from bolshakov/feature/array_serializer_options
Array serializer pass except and only options to item serializers
2014-08-22 15:26:17 -04:00
Steve Klabnik
92f1db0137 Merge pull request #596 from bolshakov/feature/instumentation
Test::Unit assert_serializer implemented
2014-08-22 15:25:52 -04:00
Arthur Nogueira Neves
9fb343b5fb Merge pull request #591 from donbobka/feature/fix_format_keys_for_array_wo_root
Feature/fix format keys for array wo root
2014-08-18 10:21:37 -04:00
Tema Bolshakov and Dmitry Myaskovskiy
eaedcefa4e Test::Unit assert_serializer implemented
So you can assert specific serializer to be used.
2014-08-18 18:04:51 +04:00
Tema Bolshakov
e3ab34dd74 Array serializer pass except and only options to item serializers 2014-08-18 14:21:08 +04:00
Tema Bolshakov
c389ae2207 Support customer array serializer 2014-08-18 12:37:01 +04:00
Vladimir Lyzo
adcea6aaf0 Fix failing test: option format_key with root option 2014-08-15 16:21:40 +04:00
Stanley Stuart
e650863c6d fix tests from rebasing master for embed_namespace 2014-08-13 11:38:01 -05:00
Paul Henry
76263865a7 fix uninitialized instance variable warning
Ruby warns that `@only` and `@except` are not initialized because if they are not passed in, they are never assigned.

Remove circular require in array_serializer
2014-08-02 14:05:37 -07:00
Tim Petricola
14b1df5c36 Custom options are accessible in serializer (via :context) 2014-07-28 13:10:02 -04:00
Steve Klabnik
045ba2a48c Merge pull request #534 from kylefritz/master
Support lowerCamel key format
2014-07-28 12:43:36 -04:00
Steve Klabnik
723049e28f Merge pull request #493 from shakirshakiel/master
fixing sideloading of nested associations
2014-07-28 12:34:17 -04:00
Kyle Fritz
76c8de7b9f root key format 2014-04-14 13:45:12 -04:00
Kyle Fritz
00c54baae3 Support lowerCamel key format 2014-03-30 12:31:21 -04:00
Wojtek Mach
2e31a14125 Add :only/:except options 2014-03-12 16:55:08 -03:00
Ken Ip
8ca4d4fcd6 HasOne nil object should return [] under embedded key.
Ensure that @wrap_in_array is always respected when set to true even
when associated object is nil.
2014-03-10 16:42:04 -03:00
Santiago Pastorino
d985e6424c Merge pull request #462 from fab/master
Generator now properly detects ApplicationSerializer
2014-02-04 10:05:03 -08:00
Fab Mackojc
a49e04a6f2 Generator now properly detects ApplicationSerializer 2014-02-01 21:37:13 +11:00
Shakir Shakiel
9ae5142775 fixing sideloading of nested associations 2014-01-22 00:07:28 +05:30
Adrian Mugnolo and Santiago Pastorino
cec7980208 Don't embed empty associations in root 2014-01-09 15:45:20 -02:00
Santiago Pastorino
3e510c829b Don't concat to nil objects 2014-01-09 15:35:29 -02:00
Jorge Bejar
df481b2b35 Don't memoize association serializer 2014-01-09 15:30:51 -02:00
Santiago Pastorino
de78df509a Version = 0.9.0.alpha1 2014-01-07 15:28:23 -02:00
Santiago Pastorino
ed9a5288f9 Revert "Merge branch 'context'"
This reverts commit 1bd8180a94, reversing
changes made to 9bb32331f4.
2014-01-07 15:02:09 -02:00