Commit Graph

453 Commits

Author SHA1 Message Date
Kevin Tham
14a35ab2f8 Remove unneeded method aliasing of attribute reader: object, with the underscored class name of serializer, to fix issue where a model's attribute name matches that of the underscored prefix of the serializer 2012-11-25 00:17:17 -08:00
Jo Liss
720f1dabf8 Merge pull request #160 from byroot/143-throw-decriptive-error
[PR] Throw a descriptive error if attempting to serialize an array with Serializer not ArraySerializer
2012-11-23 06:48:41 -08:00
Jean Boussier
06e8218193 Throw a descriptive error if attempting to serialize an array with Serializer not ArraySerializer #143 2012-11-22 23:27:18 -05:00
Jo Liss
2fc083a1fe Merge pull request #117 from joliss/computed-attributes
Make schema not crash on computed attributes & associations
2012-11-22 08:31:18 -08:00
tchak
a71698d5bb Add support for meta key
Test for meta_key serialization
2012-11-22 13:44:59 +01:00
Rafael Mendonça França
6b88f1b6ef Merge pull request #157 from frodsan/fix_readme
update travis link [ci skip]
2012-11-20 17:38:17 -08:00
Francesco Rodriguez
d3b02ab8b3 update travis link [ci skip] 2012-11-20 20:37:23 -05:00
Rafael Mendonça França
5d839e5725 Merge pull request #156 from frodsan/fix_rbx_travis_tag
Update travis.yml to use the right Rubinius versions
2012-11-20 15:57:34 -08:00
Francesco Rodriguez
584bbc9151 Update travis.yml to use the right Rubinius versions 2012-11-20 18:54:59 -05:00
Rafael Mendonça França
f3159dfd0d Merge pull request #155 from teeparham/array_serializer_test
Move ArraySerializer tests and test fakes into separate files
2012-11-20 10:47:56 -08:00
Tee Parham
2cb7a41780 move ArraySerializer tests into separate file 2012-11-20 10:58:16 -07:00
Tee Parham
f47a10cadc move test fakes to separate file 2012-11-20 10:44:23 -07:00
Steve Klabnik
5d45f5ec6f Merge pull request #152 from samnang/setting_root
Fixed root(false) vs root=false inconsistency
2012-11-20 02:36:09 -08:00
Samnang Chhun
96ce310595 Add alias_method ActiveModel::Serializer.root= to be consistency with ActiveModel::ArraySerializer 2012-11-20 00:29:00 +07:00
Jo Liss
6ca430cec3 Merge pull request #150 from kurko/fixes_new_repo_readme
Fixes repo URL in the README's installation instructions
2012-11-18 19:23:43 -08:00
Alexandre de Oliveira
3fd7d6ae2f Fixes repo URL in the README's installation instructions
When the gem moved over to github.com/rails_api/, the README instructions
were still pointing to github.com/josevalim/.
2012-11-19 01:05:00 -02:00
Jo Liss
538b0c0916 Make schema not crash on computed associations
We pick nil here as well.
2012-10-31 20:07:08 +01:00
Jo Liss
6281a9149e Make schema not crash on computed attributes
We do not know the type for computed attributes, so we pick nil.

Perhaps at some point we might add a :type option for attributes (or
not), but in any case it's important to not crash when there are
computed attributes.
2012-10-31 20:07:08 +01:00
Yehuda Katz
9f5e1b1776 Merge pull request #142 from joliss/sideloading-complexity
When objects are sideloaded multiple times, serialize them only once
2012-10-31 12:04:47 -07:00
Jo Liss
c767d7f5e4 Remove newly-redundant OrderedSet 2012-10-29 23:15:39 +01:00
Jo Liss
ee3cec3d0c When objects are sideloaded multiple times, serialize them only once
To achieve this, we make the following change when sideloading: Instead
of serializing associations and discarding duplicate *hashes*, we
memorize the *objects* (records) that we have already serialized, and
only serialize those that are new.

This change is mostly transparent, and brings down serialization time
from 3.1 seconds to 1.0 seconds on my set of sample data.

There is one change in the behavior: If you sideload the same object
multiple times, and it yields different hashes, like so:

    embed :ids, include: true
    has_many :comments
    has_many :recent_comments, root: comments, serializer: CommentShortSerializer

then previously, it would be included multiple times, whereas now, the
first hash wins. (I haven't actually tested this.) I don't know that
either option is preferable. It's not covered by the test suite, and I
think it's an edge case that is OK to ignore entirely.
2012-10-29 23:15:32 +01:00
Jo Liss
28ee88ca9a In the test, use the same :hash across serializers
Otherwise, `include!` will not remember the unique_values of
already-sideloaded hashes across serializer calls.
2012-10-29 22:48:51 +01:00
Jo Liss
6be6ed8326 Extract Associations module into separate file 2012-10-29 17:21:27 +01:00
José Valim
be70c5c846 Revert "clean up lazy loading of serialization support for
ActiveRecord::Base and ActionController::Base"

The whole idea of having a lazy hook is that it can be executed
in the context of different targets. The moment you hardcode the class,
the hooks can no longer run in the proper context.

This reverts commit 506e2ac9ad.
2012-10-17 19:28:02 +02:00
Jo Liss
634f5ba91e Merge pull request #136 from garysweaver/master
Adding documentation for :serializer and :polymorphic options on associations
2012-10-09 06:49:08 -07:00
Gary S. Weaver
9cd472c160 #133 making :serializer and :polymorphic documentation less verbose 2012-10-09 09:37:59 -04:00
Gary S. Weaver
257adfc80e #133 adding documentation for :serializer and :polymorphic options on associations 2012-10-08 17:17:14 -04:00
Jo Liss
bea38dd73a Update RELEASE_NOTES 2012-09-23 15:08:39 +02:00
Jo Liss
3c5e58bf13 Merge pull request #129 from dgeb/active-record-init
clean up lazy loading of serialization support
2012-09-21 11:34:30 -07:00
Jo Liss
0a5d3eb953 Fix assertion for Ruby 1.8.7 2012-09-21 16:57:51 +02:00
Jo Liss
646d57c438 Make test suite compatible with Rails 4
Rails 4 changes the JSONP content_type to text/javascript
2012-09-21 16:36:42 +02:00
Jo Liss
dfcbc59061 Merge pull request #131 from dgeb/travis-bundler-install
Ensure bundler is updated for travis testing of edge rails
2012-09-21 05:22:02 -07:00
Dan Gebhardt
2d7bbaa3a6 Ensure bundler is updated for travis testing of edge rails 2012-09-21 08:14:56 -04:00
Jo Liss
dcd14e13f1 Merge pull request #130 from dgeb/edge-rails-travis
Add edge rails to the Travis test matrix
2012-09-20 21:12:02 -07:00
Dan Gebhardt
0caca174e6 added edge rails on 1.9.3 to the test matrix (with failures allowed) 2012-09-20 21:38:19 -04:00
Dan Gebhardt
281b45ad2a match method should not be used for routes; instead, a specific HTTP method should be used 2012-09-20 21:17:07 -04:00
Dan Gebhardt
506e2ac9ad clean up lazy loading of serialization support for ActiveRecord::Base and ActionController::Base 2012-09-20 14:23:59 -04:00
Jo Liss
b706244122 Merge pull request #128 from dgeb/rails3+
compatibility with rails >= 3.0
2012-09-19 11:16:24 -07:00
Dan Gebhardt
a8eb21d87d compatibility with rails >= 3.0 2012-09-19 13:01:18 -04:00
Tee Parham
9584b9e147 move OrderedSet to separate file 2012-09-18 01:28:07 +02:00
Tee Parham
b8f01ba2f3 move ArraySerializer to separate file 2012-09-18 01:28:07 +02:00
Yehuda Katz
f9117072fb Describe undesirable but necessary cruft 2012-09-16 20:36:02 -07:00
Yehuda Katz
2130cdfc00 List out the event names to avoid garbage 2012-09-16 20:20:34 -07:00
Yehuda Katz
a025f1b6f6 Eliminate some String garbage 2012-09-16 20:08:30 -07:00
Yehuda Katz
9da0176d2b Merge branch 'master' of github.com:josevalim/active_model_serializers 2012-09-16 19:46:17 -07:00
Jo Liss
afc3beef16 Merge pull request #122 from oriolgual/patch-1
Document how to embed ids or objects per association
2012-09-12 14:23:50 -07:00
Jo Liss
8f1b33aad0 Merge pull request #116 from anathematic/patch-1
Added homepage in Gemspec
2012-09-12 14:21:50 -07:00
Jo Liss
98c58b47f1 Merge pull request #118 from teeparham/dev_gemspec
move development gem dependencies into gemspec
2012-09-12 14:21:20 -07:00
Yehuda Katz
a21529370c Merge pull request #123 from dgeb/conditional-includes
Conditional includes (closes #111)
2012-09-02 21:56:38 -07:00
Yehuda Katz
84f8c1c3d5 Merge branch 'master' of github.com:josevalim/active_model_serializers 2012-09-02 21:21:05 -07:00