Commit Graph

264 Commits

Author SHA1 Message Date
Marc Love
5ac6e626b5 Reduce complexity and duplication; make accessor definition more explicit 2013-10-25 15:33:24 -07:00
Santiago Pastorino
439643ba5a Fix the stupid previous commit 2013-10-24 19:23:50 -02:00
Santiago Pastorino
b44e1af5dd Move synchronize to setup method and make CONFIG private 2013-10-24 17:42:20 -02:00
Santiago Pastorino
dc33dac56b This is not being used 2013-10-24 16:57:42 -02:00
Santiago Pastorino
dfdc292e35 Align = 2013-10-24 16:32:18 -02:00
Arthur Neves
860acad9af s/side_load/embed_in_root 2013-10-24 14:12:02 -04:00
Santiago Pastorino
2b70503896 Add ActiveModel::SerializerSupport 2013-10-24 16:09:00 -02: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
5c6541145a Allow to embed nothing but still side loading
Closes #361, #399, #401
2013-10-24 13:24:49 -02:00
Łukasz Strzałkowski
d46584af40 Wrap config's data hash in mutex 2013-10-21 20:27:01 +00:00
Arthur Neves
05ec509e1c Use ActiveSupport::Deprecation.warn instead of warn 2013-10-21 15:02:39 -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
84801301b9 Add deprecation message to .embed method 2013-10-21 13:08:07 -04:00
Arthur Neves
41f1855056 Add accessors to settings class 2013-10-21 13:05:39 -04:00
Santiago Pastorino
4ab16381bd Bump version to 0.9.0.pre 2013-10-18 17:49:22 -02:00
Santiago Pastorino
73774649e3 Implement Generators 2013-10-18 17:49:21 -02:00
Santiago Pastorino
91f9317713 There's no need to define read_attribute_for_serialization in the Serializer class 2013-10-18 17:49:21 -02:00
Santiago Pastorino
b9a6dfac2f Do not call send on associated objects, do it through elem.read_attribute_for_serialization 2013-10-18 17:49:21 -02:00
Santiago Pastorino
4b91d0e5ec embed :objects is the default
A commit with an integration test that covers this functionality is
coming after this one
2013-10-18 17:49:20 -02: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
cad8fafa60 Optimize serializer_for for Ruby >= 2.0 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
f6ea07dd22 Do not convert attrs to String until needed 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
aa23e811cc Use controller name as root when serializing an array and not root is defined 2013-10-18 17:49:20 -02:00
Santiago Pastorino
86b9d5a226 Avoid work inside serializable_array 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
3fcd8c5f98 Define root and root= as aliases of _root= 2013-10-18 17:49:18 -02:00
Santiago Pastorino
7ba05c02e3 Make Serializable module which implements as_json 2013-10-18 17:49:18 -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
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
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