Commit Graph

240 Commits

Author SHA1 Message Date
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
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
Dan Gebhardt
7fc8606101 documentation of conditional include options for serializers 2012-08-29 10:54:56 -04:00
Dan Gebhardt
42221a6140 define include_XXX? methods, which can be overridden to conditionally include attributes and associations 2012-08-29 09:26:41 -04:00
Dan Gebhardt
68dc57eb73 simplified the API for include_associations!() to make conditional includes cleaner 2012-08-29 07:42:23 -04:00
Oriol Gual
027f1580dc Document how to embed ids or objects per association 2012-08-27 11:51:16 +03:00
José Valim
001c1d0634 Merge pull request #121 from twinturbo/polymorphic-update
Easier to work with polymorphic interface
2012-08-25 09:43:38 -07:00
twinturbo
38859d1f3d Easier to work with polymorphic interface 2012-08-25 17:39:39 +02:00
Tee Parham
caf2daaa60 move development gem dependencies into gemspec 2012-08-23 21:13:16 -06:00
Thomas
4b429c1f6e Added homepage in Gemspec 2012-08-16 12:11:36 +10:00
José Valim
655c4fe1c2 Merge pull request #110 from pivotal-medici/fix_default_url_options
Return empty hash when url_options not provided
2012-08-07 10:22:05 -07:00
Alex Kwiatkowski & Will Bagby
754aa295ba Return empty hash when url_options not provided 2012-08-07 12:56:58 -04:00
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