Adrian Mugnolo and Santiago Pastorino
ceded40aa1
Move serialization tests to serialization_test.rb
2013-12-16 16:59:04 -02:00
Adrian Mugnolo and Santiago Pastorino
af7437b7e4
Split basic object and model array serialization tests
2013-12-16 16:50:50 -02:00
Santiago Pastorino
5c00ce0443
Merge pull request #451 from plexus/embed_in_root_merge
...
embed_in_root only returns the associated objects of a single instance
2013-12-16 10:39:53 -08: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
1db96ec7a9
When using embed: :ids ; embed_in_root: true, and serializing multiple objects,
...
only the associated objects of the last object in the collection will actually
show up in the serialized data.
For example, if you serialize a collection of two posts, each containing one or
more comments, only the comments of the last post show up. The reason is a
Hash#merge wich overwrites the array rather than appending to it.
This commit fixes this by merging the collection arrays, rather than the top-level
hashes.
2013-11-11 14:30:34 +01:00
Todd Bealmear
6f04f86ae5
Fixed test for Rails versions prior to 4
2013-11-05 10:42:55 -08:00
Todd Bealmear
f10f72c763
Fixed Rails 4 Controller Scaffold Generator.
2013-11-04 17:31:19 -08: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
Jorge Bejar
021efae95b
Change hardcoded class in favor of using provided serializer class in AR integration tests
2013-11-03 18:21:21 -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
5598bb0f79
Make Associations in root work with ArraySerializer
...
Closes #414
2013-10-31 17:27:36 -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
Santiago Pastorino
df5ef33ae6
Allow to turn off ams
...
Closes #378
You can define now
```
def default_serializer_options
{ serializer: false }
end
```
2013-10-23 20:34:34 -02:00
Santiago Pastorino
06e4c2c9d6
Test attributes declared as strings
...
Thanks @mikegee
Closes #380
2013-10-22 11:55:32 -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
Arthur Neves
f6d5340f89
Require minitest instead of test/unit
2013-10-18 17:49:22 -02:00
Arthur Neves
cf8b55ea01
Setting join_table on AR tests
2013-10-18 17:49:22 -02:00
Santiago Pastorino
b81deac320
Add coverage tools
2013-10-18 17:49:21 -02:00
Santiago Pastorino
73774649e3
Implement Generators
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
94a83c1cc0
Make relationship graph of AR integration tests bigger
2013-10-18 17:49:21 -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
23e6ed32be
Add default_serializer_options test
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
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
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
8462a73f3a
Make render json work when not using AMS
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
29148cbe1c
Add AC::Serialization#serialization_scope as a class level method
2013-10-18 17:49:19 -02:00