Commit Graph

1525 Commits

Author SHA1 Message Date
lsylvester
3fb560908e cache the serializers for a class 2015-03-11 09:53:47 +11:00
Guillermo Iguaran
d55f3b33b4 Merge pull request #811 from mateomurphy/scope
Reimplement serialization scope and scope_name
2015-03-10 10:16:06 -05:00
Josh Smith
c6d6021f32 Add link to our labels 2015-03-08 12:33:00 -07:00
Josh Smith
fa4a6a7ae7 Add CONTRIBUTING.md and update README.md to point to it 2015-03-08 12:30:43 -07:00
Alexandre de Oliveira
3389218fd3 Merge pull request #725 from ggordon/has_one_support
Support has_one to be compatible with 0.8.x
2015-03-05 15:08:25 -08:00
Alexandre de Oliveira
32343d4575 Merge pull request #822 from bf4/fix_has_one
Replace has_one with attribute in template
2015-03-03 11:13:29 -08:00
Gary Gordon
c6044286ef Workaround order dependent test failure 2015-03-01 13:47:40 -05:00
Gary Gordon
651b99f22e Support has_one to be compatible with 0.8.x
Update README and CHANGELOG
2015-03-01 13:47:34 -05:00
Alexandre de Oliveira
77fb050d24 Merge pull request #821 from wjordan/patch-1
Fix explicit serializer for associations
2015-03-01 08:46:27 -05:00
Alexandre de Oliveira
3505bc64a3 Merge pull request #798 from donbobka/feature/fix_lost_test
Fix lost test `test_include_multiple_posts_and_linked`
2015-03-01 08:41:13 -05:00
Benjamin Fleischer
79653ac733 Replace has_one with attribute in template 2015-02-25 14:20:18 -06:00
Will Jordan
f4eb33d6e9 Update test_includes_linked_comments with correct expected result 2015-02-24 18:46:04 -08:00
Will Jordan
f2ee544a88 Fix explicit serializer for associations 2015-02-24 16:01:43 -08:00
Mateo Murphy
232e367560 Add serialization_scope_name_test 2015-02-12 17:48:43 -05:00
Mateo Murphy
2962f3f64e Reimplement serialization scope and scope_name 2015-02-09 11:24:41 -05:00
Guillermo Iguaran
a8243761fe Merge pull request #807 from alexstophel/update-readme
Add Overriding attribute methods section to README.
2015-02-07 17:16:34 -05:00
Alex Stophel
13243f2e70 Add Overriding attribute methods section to README. 2015-02-07 00:09:50 -05:00
Alexandre de Oliveira
5680436f9e Merge pull request #693 from joaomdmoura/cache-support
Cache Support at AMS 0.10.0
2015-02-04 10:38:25 -02:00
Joao Moura
8a432ad2b3 Adding cache support to version 0.10.0
It's a new implementation of cache based on ActiveSupport::Cache.
The implementation abstracts the cache in Adapter class on a
private method called cached_object, this method is intended
to be used on Adapters inside serializable_hash method in order
to cache each instance of the object that will be returned by
the serializer.

Some of its features are:
- A different syntax. (no longer need the cache_key method).
- An options argument that have the same arguments of ActiveSupport::Cache::Store, plus a key option that will be the prefix of the object cache on a pattern "#{key}-#{object.id}".
- It cache the objects individually and not the whole Serializer return, re-using it in different requests (as a show and a index method for example.)
2015-02-02 14:53:34 -02:00
Vladimir Lyzo
54d6696e7c Fix lost test test_include_multiple_posts_and_linked 2015-01-31 19:44:22 +03:00
Guillermo Iguaran
42644544e1 Merge pull request #792 from rails-api/association-overrides
Association overrides
2015-01-30 09:01:49 -05:00
Alexandre de Oliveira
ba1905a915 Merge pull request #794 from carlesjove/to_param
add to_param for correct URL generation
2015-01-30 11:06:33 -02:00
Carles Jove i Buxeda
637113ecd5 add to_param for correct URL generation 2015-01-30 11:08:08 +01:00
Alexandre de Oliveira
e771e637bf Updates CHANGELOG to include association overriding 2015-01-29 16:52:39 -02:00
Alexandre de Oliveira
e47231cdc8 Support overriding association methods
You can override associations to define custom scope on them.
2015-01-29 16:52:18 -02:00
Guillermo Iguaran
652493848a Merge pull request #774 from nhocki/fix_nested_linked_objects
Fix nested include attributes
2015-01-13 17:01:23 -05:00
Nicolás Hock Isaza
1d7d9fd6aa Fix nested include attributes
When the requests asked for a nested attribute in the `include` and it's
missing or empty, don't break because the type of the object can't be
determined.

If the request is for a collection and none of the elements has the
attribute, it will not be added to the `linked` key, similar to what
happens with simple includes.
2015-01-13 14:49:58 -05:00
Guillermo Iguaran
22202a115a Lets keep the assert_equal without parens for consistency. 2015-01-11 16:21:20 -05:00
Guillermo Iguaran
7085afe714 Merge pull request #771 from sweatypitts/master
Make linked resource type names consistent with root names
2015-01-11 16:20:15 -05:00
Robbie Pitts
b626ec8f14 Spec for linked resource type name demodulization 2015-01-11 16:10:02 -05:00
Robbie Pitts
90023b1af7 Make linked resource type names consistent with root names 2015-01-11 14:24:01 -05:00
Alexandre de Oliveira
6eb75af96b Merge pull request #696 from ggordon/explicit_serializer
Explicitly set serializer for associations
2015-01-06 09:57:07 -02:00
Alexandre de Oliveira
87f817943a Merge pull request #700 from arenoir/sparse_fieldsets
sparse fieldsets
2015-01-06 09:38:51 -02:00
Guillermo Iguaran
3a60633545 Merge pull request #768 from rails-api/adds-meta
Adds support for meta attribute
2015-01-05 00:10:09 -05:00
Alexandre de Oliveira
bd27da1b76 Adds support for meta attribute
Currently, 0.10.0.pre doesn't support `meta` option in `render`. This
way, there's no way to support features such as pagination. `0.9` had
this feature in place.

This adds support for it, as well as fixes small things in README.md.

This won't support `meta` in array responses because arrays don't have
keys, obviously. Also, the response should have a `root` key, otherwise
no `meta` will be included.

In some cases, for example using JsonApi, ArraySerializer will result in
a response with a `root`. In that case, `meta` will be included.
2015-01-05 02:56:33 -02:00
Steve Klabnik
282de21984 Merge pull request #753 from tricknotes/ruby-22
Test against Ruby 2.2 on Travis CI
2014-12-09 23:52:01 -05:00
Ryunosuke SATO
b3dc3f4dbe Test against Ruby 2.2 on Travis CI 2014-12-10 02:40:47 +09:00
Ryunosuke SATO
2135256004 Test against latest Ruby 2.1.x on Travis CI 2014-12-10 02:40:45 +09:00
Steve Klabnik
c67da11b96 Merge pull request #745 from jockee/patch-1
Missing a word
2014-12-04 17:20:33 +01:00
Joakim Ekström
9768da7a70 Missing a word 2014-12-04 17:05:10 +01:00
Steve Klabnik
8bbf6b8c8b Merge pull request #707 from jherdman/patch-1
A Friendly Note on Which AMS Version to Use
2014-11-20 10:27:19 -05:00
James Herdman
faa6f906d6 A Friendly Note on Which AMS Version to Use
Per the discussion in #702, I figured it might be nice to note which
version of AMS is recommended to be used in new projects.
2014-11-20 10:20:04 -05:00
Alexandre de Oliveira
a933d44673 Merge pull request #730 from rails-api/fixes-nested-has-many-links
Fixes nested has_many links in JSONAPI
2014-11-17 11:30:20 -02:00
Aaron Renoir
2ed52f96a6 merge upstream update fieldset 2014-11-13 17:45:47 -08:00
Alexandre de Oliveira
2f5626d616 Fixes nested has_many links in JSONAPI
When linked resource had has_many links, all of them would use the
association from the first resource, causing all of the items to build
`links` with the same associations.

This fixes it by iterating over the serializers, not just the
attributes array.
2014-11-13 16:38:47 -02:00
Alexandre de Oliveira
c53f1da18e Merge pull request #718 from ggordon/adapter_override
Allow overriding the adapter with render option
2014-11-13 13:59:12 -02:00
Gary Gordon
5560b49098 Allow overriding the adapter with render option
Make it easy to use multiple adapters in an app.

use "adapter: false" to not use ams

make a test override config.adapter
2014-11-13 10:23:19 -05:00
Gary Gordon
9f9715801a Explicitly set serializer for associations
Document specifying serializer for assocaition
2014-11-13 10:17:59 -05:00
Alexandre de Oliveira
08fbba9087 Merge pull request #720 from ggordon/attribute_with_key
Rename attribute with :key (0.8.x compatibility)
2014-11-13 11:38:06 -02:00
Gary Gordon
08716d20c9 Rename attribute with :key (0.8.x compatibility) 2014-11-13 08:03:22 -05:00