Commit Graph

53 Commits

Author SHA1 Message Date
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
Arthur Neves
41f1855056 Add accessors to settings class 2013-10-21 13:05:39 -04:00
Santiago Pastorino
4f70dc2091 has_one serialized objects shouldn't be wrapped in an array and it's key is singular 2013-10-18 17:49:20 -02:00
Santiago Pastorino
dbf512c14c Make embed nil ids work 2013-10-18 17:49:20 -02:00
Santiago Pastorino
841f3b8181 Add filter to allow users implement filter method to include/exclude attributes and relations 2013-10-18 17:49:20 -02:00
Santiago Pastorino
daa9304398 Do not convert root and meta_key to Strings 2013-10-18 17:49:20 -02:00
Santiago Pastorino
75e9a2599d Store attributes as they are instead of converting them into Strings 2013-10-18 17:49:20 -02:00
Santiago Pastorino
10e882a14f Allow to set embed options from AM::Serializer 2013-10-18 17:49:20 -02:00
Santiago Pastorino
8006529e20 Allow ArraySerializer to pass the options down to item serializers 2013-10-18 17:49:19 -02:00
Santiago Pastorino
6f3503c965 Use serializer name as root when root not set 2013-10-18 17:49:19 -02:00
Santiago Pastorino
626a85bc3e Allow using root = false in initialize 2013-10-18 17:49:19 -02:00
Santiago Pastorino
7405baafd7 Serialize associations that doesn't have an associated serializer 2013-10-18 17:49:19 -02:00
Santiago Pastorino
513e7f2166 Add setup method and Setting object to configure AMS 2013-10-18 17:49:19 -02:00
Santiago Pastorino
0e0341effc Implement embed in root 2013-10-18 17:49:19 -02:00
Santiago Pastorino
af34adc7b5 Move key's initialization code to initializers 2013-10-18 17:49:19 -02:00
Santiago Pastorino
280fd65db8 Allow to set key for associations through options 2013-10-18 17:49:19 -02:00
Santiago Pastorino
48590a2e37 Allow to set root for associations through options 2013-10-18 17:49:19 -02:00
Santiago Pastorino
8a495b1d00 Embedded has_one returns an array with the key pluralized 2013-10-18 17:49:19 -02:00
Santiago Pastorino
e6993c677b Add missing requires 2013-10-18 17:49:18 -02:00
Santiago Pastorino
a820e9774f Add ArraySerializer's root and meta features 2013-10-18 17:49:18 -02:00
Santiago Pastorino
70ea6c6bc7 Add has_one and has_many :serialize => tests 2013-10-18 17:49:18 -02:00
Santiago Pastorino
cd3e5e9de2 Assign the association in the setup method 2013-10-18 17:49:18 -02:00
Santiago Pastorino
f647b7ae74 Implement each_serializer 2013-10-18 17:49:18 -02:00
Santiago Pastorino
7e83f0c29d Implement ArraySerializer 2013-10-18 17:49:18 -02:00
Santiago Pastorino
61a1669a86 Implement has_many 2013-10-18 17:49:18 -02:00
Santiago Pastorino
4c7599cfff Use more meaningful model names for tests 2013-10-18 17:49:18 -02:00
Santiago Pastorino
516f5bdceb Implement has_one's embed ids include true 2013-10-18 17:49:18 -02:00
Santiago Pastorino
52bb3f6929 Implement has_one's embed objects 2013-10-18 17:49:17 -02:00
Santiago Pastorino
d756ae4a70 Implement has_one's and serialize_ids 2013-10-18 17:49:17 -02:00
Santiago Pastorino
01bc534976 Remove SerializerSupport 2013-10-18 17:49:17 -02:00
Santiago Pastorino
0d4dfb69a9 Fix directories the project is on top level dir 2013-10-18 17:49:17 -02:00
Santiago Pastorino
93baaa96b1 Implement meta and meta_key for AM::Serializer 2013-10-18 17:49:17 -02:00
Santiago Pastorino
af357619c1 Add AMS support to AR objects 2013-10-18 17:49:17 -02:00