Commit Graph

243 Commits

Author SHA1 Message Date
José Valim
dd5cdb6ddb Merge pull request #106 from raycohen/scope_option_precedence
Scope option precedence
2012-07-29 03:06:47 -07:00
Ray Cohen
424dacb457 scope option to render takes precedence over serialization_scope 2012-07-28 21:06:15 -04:00
Ray Cohen
1e7c69c729 Test for having scope option to render override the controller's serialization scope 2012-07-28 19:05:45 -04:00
José Valim
21817bc795 Merge pull request #105 from raycohen/readme-fix-custom-attributes
fix custom attributes with scope readme section
2012-07-28 10:21:39 -07:00
Ray Cohen
63465fda68 fix custom attributes with scope readme section 2012-07-28 13:01:06 -04:00
José Valim
dbde02d647 Merge pull request #103 from joliss/cleanup
Use blocks instead of eval to define methods
2012-07-25 23:34:29 -07:00
Jo Liss
e8f2ecebfb Use blocks instead of eval to define methods 2012-07-26 00:28:59 +02:00
José Valim
3f75c14267 Merge pull request #101 from teeparham/patch-1
fix typo in README
2012-07-24 00:57:46 -07:00
Tee Parham
6a37cfe219 fix typo in README 2012-07-23 14:07:49 -06:00
José Valim
ff7c6adb58 Merge pull request #100 from teeparham/readme-arrays
Add section on Arrays to README
2012-07-23 12:14:59 -07:00
Tee Parham
663d443884 Merge branch 'array-serializer-root' of github.com:teeparham/active_model_serializers into readme-arrays 2012-07-23 13:02:04 -06:00
Tee Parham
3ecf22a249 more README markdown cleanup 2012-07-23 12:55:47 -06:00
Tee Parham
f8263153b6 cleanup markdown in docs 2012-07-23 12:49:02 -06:00
Tee Parham
53da0b12fd add docs for serializing arrays 2012-07-21 15:25:41 -07:00
Tee Parham
bf2fa2d31c add docs for custom serializers 2012-07-21 15:25:08 -07:00
José Valim
b813646076 assert_include is not available before 1.9 2012-07-21 10:01:27 +02:00
José Valim
77b873a9a4 Update release notes for upcoming release 2012-07-21 09:52:39 +02:00
José Valim
e886f597c7 Sets are not ordered, do not depend on the order 2012-07-21 09:48:12 +02:00
José Valim
ef7d475912 Merge pull request #94 from teeparham/array-serializer-root
Add root option to ArraySerializer
2012-07-21 00:38:18 -07:00
José Valim
62484e758c Merge pull request #95 from twinturbo/set-serializer
Close #90
2012-07-21 00:37:31 -07:00
José Valim
6f07a0297e Merge pull request #97 from twinturbo/include-bug
Include Related Bugs
2012-07-21 00:36:04 -07:00
José Valim
0123e80dd3 Update README.markdown 2012-07-21 10:35:25 +03:00
José Valim
e122675373 Merge pull request #99 from matthewrobertson/master
Documentation on how to add custom attributes
2012-07-21 00:27:52 -07:00
Matthew Robertson
91945f02c8 Added a section to the README about defining custom attributes by overriding serializable_hash 2012-07-20 15:18:30 -07:00
José Valim
90af9e0d16 Merge pull request #98 from ccschmitz/patch-1
Fix a couple typos
2012-07-16 08:19:27 -07:00
Chris Schmitz
a6473e70c4 Fix a couple typos. 2012-07-16 09:29:12 -05:00
twinturbo
6f3b250dc9 Don't include empty polymoprhic associations
Take this serializer:

class TodoSerializer < ActiveModel::Serializer
  root :todo, :include => true
  has_one :reference, :polymorphic => true
end

A nil reference would generate this JSON:

{
  "todo": { "reference": null },
  "nil_classes": []
}

This commit prevents the `nil_classes` key from being added when
serializing and including nil polymoprhic associations.
2012-07-16 15:08:01 +02:00
twinturbo
486d282922 Raise error when associations cannot be included
include! only works when the source serializer has a root set. The
as_json method sets up some state for the include! method. If a child
association has associations with `:include => true` or `root foo,
:include => true` would cause an undefined method error for `NilClass`.
This is entirely unhelpful for the end user.

This commit raise an error when this situation occurs. It makes it clear
that it's not a problem with AMS but the serialization graph.
2012-07-16 14:18:58 +02:00
twinturbo
5111615ac1 Actually test set serialization 2012-07-15 13:42:29 +02:00
José Valim
f2714ace8a Merge pull request #96 from bradleypriest/fixbuild
Fix Travis on 1.8.7
2012-07-15 04:21:00 -07:00
Bradley Priest
f85c624d02 Fix travis 2012-07-15 18:50:47 +08:00
twinturbo
7072e79787 Close #90 2012-07-15 12:18:41 +02:00
José Valim
7d1568f2b8 Merge pull request #50 from twinturbo/polymorphism
Polymorphism
2012-07-15 03:18:33 -07:00
twinturbo
f01fe14972 Fix spelling mistakes 2012-07-15 11:49:36 +02:00
twinturbo
cbd7d7d385 Add test for nested included polymoprhic associations 2012-07-15 11:49:36 +02:00
twinturbo
c4e5cd547b Add test for complex polymorphic associations 2012-07-15 11:49:36 +02:00
twinturbo
9f20fe8b36 Test passes 2012-07-15 11:49:36 +02:00
twinturbo
3ca1621011 Add failing test for polymorphic with include 2012-07-15 11:49:36 +02:00
twinturbo
7e96856b87 Support serialize polymorphic id 2012-07-15 11:49:36 +02:00
twinturbo
32f8779114 Basic rooted polymorphism 2012-07-15 11:49:36 +02:00
Tee Parham
84c7cfa988 fix test for custom serializer, add test for :each_serializer 2012-07-14 22:03:14 -06:00
Tee Parham
0832e42917 add class attribute :root to ArraySerializer
You can now set the default behavior for Array serialization in a
single place
2012-07-14 21:44:23 -06:00
José Valim
56824f055b Update master 2012-07-14 18:17:36 +03:00
José Valim
565ad580b6 Merge pull request #93 from twinturbo/scoped
Add "scope" method
2012-07-14 07:06:51 -07:00
twinturbo
7936e3efba Add "scope" method 2012-07-14 14:54:23 +02:00
José Valim
3e87c6414d Merge pull request #92 from twinturbo/query-attributes
Close #86
2012-07-14 04:16:07 -07:00
twinturbo
2b9cd97436 Close #86 2012-07-14 13:12:26 +02:00
José Valim
d6a68ed14f Merge pull request #85 from pushcx/master
Allow setting :each_serializer in 'render :json' calls
2012-07-14 04:05:40 -07:00
José Valim
b91e63c4ec Merge pull request #88 from bradleypriest/ar-relation
Automatically include ArraySerializer in ActiveRecord::Relation
2012-07-11 04:04:38 -07:00
Bradley Priest
f41978b8de move array_serializer logic to active_model_serializer.rb 2012-07-10 10:23:45 +08:00