Commit Graph

78 Commits

Author SHA1 Message Date
Andrey Krivko
dce6e59772 Auto-include url_helpers for Rails-apps. Fixes #563 2014-09-29 17:16:33 +07:00
Andrey Krivko
bded293529 Add auto-stripping of question mark for attributes 2014-09-26 15:42:41 +07:00
Gauthier Delacroix
efa22d9d44 Add plural_default_root config option 2014-09-12 18:56:51 +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
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
Pol Miro
bb18fc6225 Add tests for has_one polymorphic 2014-08-25 23:32:09 -07:00
Pol Miro
63589f7500 Add tests for has_many polymorphic 2014-08-25 23:32:09 -07: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
ae7959b76e Merge pull request #512 from TimPetricola/fix-options-access
Custom options are accessible in serializer
2014-08-22 16:15:41 -04:00
Stanley Stuart
e650863c6d fix tests from rebasing master for embed_namespace 2014-08-13 11:38:01 -05:00
Tim Petricola
14b1df5c36 Custom options are accessible in serializer (via :context) 2014-07-28 13:10:02 -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
1ec499bd64 Use Minitest::Test instead of ActiveModel::TestCase 2014-01-09 21:52:10 -02:00
Jorge Bejar
df481b2b35 Don't memoize association serializer 2014-01-09 15:30:51 -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
Adrian Mugnolo and Santiago Pastorino
0d8ef2b165 Nest scope under context option 2014-01-06 15:50:30 -02:00
Santiago Pastorino
8bd2542ed2 Allow to pass context around serializers 2014-01-06 12:22:16 -02:00
Santiago Pastorino
5fa4002039 Allow only to pass scope to associations
Closes #483
2014-01-03 19:48:01 -02:00
Santiago Pastorino
60fc55021c Revert "Allow to pass options to associations"
This reverts commit c8cfe94f29.
2014-01-03 19:44:40 -02:00
Santiago Pastorino
c8cfe94f29 Allow to pass options to associations
Closes #331
2014-01-02 19:56:08 -02:00
Santiago Pastorino
67c550f2ee Serialize embedding in root deeply nested associations
Closes #444
2014-01-02 18:34:11 -02:00
Adrian Mugnolo and Santiago Pastorino
f14f931957 Clean up HasOne array wrapping logic
Introduce private _wrap_in_array option for now.
2013-12-17 15:42:35 -02:00
Santiago Pastorino
80d9fb56d2 Merge pull request #452 from plexus/has_one_each_serializer_fix
Using a HasOne association twice raises an exception (Undefined method `map')
2013-12-16 17:49:26 -08:00
Adrian Mugnolo and Santiago Pastorino
700e6b83c1 Serializers now inherit root 2013-12-16 17:55:50 -02:00
Santiago Pastorino
f72115fb79 Test association inheritance in serializers 2013-12-16 17:45:24 -02:00
Stas SUȘCOV
0febd8f628 Serializers now inherit attributes and associations. 2013-12-11 17:59:32 +02:00
Jason Truluck
a110df6caf Add @options back into serializers to maintain the functionality of render :json as noted in the docs
This functionality used to exist in v0.8.1. This adds the ability to
pass other options that will be usable in the serializer via the
options accessor.

This works by adding an attr_accessor for options so it is available
and is set by the remaining options in the provided options hash during
initialization.
2013-11-12 12:57:31 -05:00
Arne Brasseur
8c3866532a Fixes a bug in the HasOne association where serializing twice in a row causes
an exception.
2013-11-11 15:30:46 +01:00
Santiago Pastorino
99677c0c58 Pass scope through to associations via @lastobelus
Closes #433
2013-11-04 10:48:19 -02:00
Santiago Pastorino
60b5901af8 Don't treat has_one associations embed objects as an array
Closes #442

Thanks @arrtchiu for reporing and giving a test case
2013-11-04 10:09:29 -02:00
Santiago Pastorino
66f9256534 Embed objects should return singular and not wrap in array
Closes #437
2013-11-01 14:22:52 -02:00
Santiago Pastorino
4d4b820cbe has_one returns arrays with roots pluralized 2013-10-30 15:26:13 -02:00
Santiago Pastorino
49ab359a34 Support passing a custom ArraySerializer for has_many associations
Thanks @phoet

Closes #316
2013-10-29 00:26:45 -02:00
Arthur Neves
860acad9af s/side_load/embed_in_root 2013-10-24 14:12:02 -04:00
Santiago Pastorino
cef6f85f44 Deprecate include in favor of side_load 2013-10-24 15:09:26 -02:00
Santiago Pastorino
48db253765 embed_in_root is now side_load 2013-10-24 14:57:41 -02:00
Santiago Pastorino
d26b7df158 Add test that checks if configs are applied to associations 2013-10-24 14:26:56 -02:00
Santiago Pastorino
a732efbc3c Clean up tests a bit 2013-10-24 13:54:49 -02:00
Santiago Pastorino
d2f2508825 Reuse ivar 2013-10-24 13:40:24 -02:00
Santiago Pastorino
04f8c0c16f Those are config tests 2013-10-24 13:37:15 -02:00
Santiago Pastorino
c83e643edd Those lines are not needed 2013-10-24 13:35:57 -02:00
Santiago Pastorino
5c6541145a Allow to embed nothing but still side loading
Closes #361, #399, #401
2013-10-24 13:24:49 -02:00
Arthur Neves
55baaf2005 Dont use Class.embed on test 2013-10-21 15:10:00 -04:00
Arthur Neves
2ea0920f08 s/assert/assert_equal 2013-10-21 14:27:18 -04:00
Santiago Pastorino
7dcef9f0f5 Rename Settings to Config and use accessors to configure things 2013-10-21 16:23:35 -02:00