Tee Parham
f35a2261d2
support different serializations in ArraySerializer
...
ArraySerializer can serialize arrays of Hash, ActiveModel::Serializer,
or any PORO that responds to :as_json
Each item in the array should not include its type as a root element,
since normal arrays do not do this. If you want "typed" collections,
don't use an Array.
2012-05-30 14:52:52 -06:00
Tee Parham
00db4dd6db
rename test methods so tests run
...
incidentally test_array_serializer_with_root fails
2012-05-30 11:14:49 -06:00
Yehuda Katz
56b61b1532
Add URL to serializers ( closes #61 )
...
Thanks so much to @vanstee for the initial
implementation!
2012-05-16 18:35:30 -07:00
Yehuda Katz
5f4f6a3483
Merged on_load
2012-05-16 18:17:21 -07:00
Yehuda Katz
0f1ec7a3cf
Add support for customizing fields
2012-05-16 18:13:59 -07:00
James A. Rosen
4c17a22207
add ActiveSupport.on_load announcement
2012-05-16 15:31:32 -07:00
ctide
f17e4cde39
Add a :root option to associations, which enables you to define what the root level key will be for the associated objects.
2012-02-22 19:35:10 -08:00
Yehuda Katz
671fc14888
remove scope as a separate concept and pass it in
...
as an option.
2012-01-11 21:16:02 -07:00
Yehuda Katz
d2c88c9dd2
Clean up pending tests
2012-01-11 20:09:28 -07:00
Yehuda Katz
d42634a1d2
Remove dead code.
2012-01-11 15:54:41 -07:00
Yehuda Katz
b22eebf569
More refactoring:
...
* Changed associations to be classes
* remove @hash and always use @options[:hash]
* pass serializer options down to child serializers
2012-01-11 15:28:49 -07:00
Yehuda Katz
ab1a4074ba
Revert polymorphism
2012-01-11 11:13:32 -07:00
Yehuda Katz
4965558d27
with ember :ids, :include => true, has_one
...
associations should include plural versions at
the root, not singular ones.
2012-01-10 15:16:00 -07:00
José Valim
1470e3a3f4
Merge pull request #24 from Adman65/polymorphic-associations
...
Polymorphic associations
2012-01-03 03:40:56 -08:00
adman65
09bb41fbdb
Add test cases for nil polymorphic associations
2012-01-03 13:37:39 +02:00
Yehuda Katz
e23553be23
The Array serializer should not make a child root for every item in the Array
2011-12-29 18:13:25 -08:00
adman65
da0c33f53c
Improve polymorphic associations
2011-12-21 20:25:40 +02:00
José Valim
cc5f102e2d
Remove implicit constant lookup in serializers in favor active_model_serializer API.
2011-12-21 08:48:29 +01:00
José Valim
97ff4d28e6
Allow as_json(true) to be given.
2011-12-21 08:17:22 +01:00
adman65
c8c8246e24
Pull in upstream
2011-12-21 00:00:09 +02:00
Yehuda Katz
df9ad0ef11
Improve serializers:
...
* Many nested levels of associations can now insert
their information alongside the original when
embed :ids, :include => true is true
* Add support for passing options to serializers
* Fix Array serializers so they don't try to insert
roots for each child object and so they can be
provided a root.
* TODO: Array serializers should require a root
* TODO: Make merging associations at the root more
efficient if possible
2011-12-20 00:03:29 -08:00
Yehuda Katz
8bdb7da272
Fix compatibility mistakes with ActiveRecord
2011-12-19 23:07:55 -08:00
Adman65
1e32090477
Serialize polymorphic id like a composite FK
2011-12-12 14:41:34 +01:00
Adman65
638614ffde
Move polymorphic type into the serializable_hash
2011-12-12 14:33:18 +01:00
Adman65
9fa716e452
Fixes #12
2011-12-12 13:13:38 +01:00
Adman65
2c240cf2e0
Implicit detection for has_many serializer
2011-12-09 16:16:09 +01:00
Yehuda Katz
09ddc79ce0
Better tests for embeds
2011-12-07 15:12:56 -08:00
Yehuda Katz
57ef67dcb4
Allow attribute aliasing
2011-12-07 14:35:07 -08:00
Yehuda Katz
7dd3bdaca9
We can't just piggyback on serialization because it may already be included at this point.
2011-12-07 12:25:11 -08:00
Yehuda Katz
ca7786c2e0
Rename :as to :key, as it's confusing
2011-12-07 12:16:22 -08:00
Yehuda Katz
0f4b61fbcf
Provide a schema for a serializer
2011-12-07 11:56:27 -08:00
Adman65
498c780a8f
Closes #4
2011-12-06 15:52:28 +02:00
José Valim
5a230e8e66
Added tests.
2011-12-01 08:19:14 +01:00