Commit Graph

179 Commits

Author SHA1 Message Date
Bruno Bacarini
59ae84baba exchange to a faster regex to get origina_url 2015-08-18 19:04:03 -03:00
Bruno Bacarini
77a8f66ad8 fix message on raise of pagination links class 2015-08-18 19:04:03 -03:00
Bruno Bacarini
e0d050d2af remove resource and options attr_reader from array_serialize 2015-08-18 19:04:03 -03:00
Bruno Bacarini
7be25fef14 include query_parameters on pagination links as well 2015-08-18 19:04:03 -03:00
Bruno Bacarini
e62a7d6f34 return complete URIs on pagination links 2015-08-18 19:04:03 -03:00
Bruno Bacarini
1fe8b06986 exchange pagination class to inside json_api scope 2015-08-18 19:04:02 -03:00
Bruno Bacarini
b864302695 remove 'page object' on paginations links' 2015-08-18 19:04:02 -03:00
Bruno Bacarini
f7c77c1256 add feature to include pagination links in response 2015-08-18 19:04:02 -03:00
João Moura
e384b65f5d Merge pull request #1048 from bf4/cleanup_meta_in_adapter
Let FlattenJson adapter decide it doesn't include meta
2015-08-18 16:23:03 -03:00
Benjamin Fleischer
98d009a000 Let FlattenJson adapter decide it doesn't include meta 2015-08-18 15:13:21 -04:00
Aaron Lerch
35c8f0d835 Update fragment cache to support namespaced objects 2015-08-17 17:12:30 -04:00
Mikhail Topolskiy
e8e4bdefd2 Use underscored json_root 2015-08-13 20:31:48 +03:00
João Moura
b4949fbc2a Merge pull request #1049 from bf4/fix_json_api_adapter_serialable_hash
Fix incorrect s/options = {}/options ||= {}
2015-08-12 11:08:39 -03:00
Benjamin Fleischer
43e09c03de Fix incorrect s/options = {}/options ||= {}
Introduced in #965, surfaced in #1041
2015-08-11 17:08:09 -05:00
Josh Lane
033ce8e88d allow for a type attribute
* "namespace" json_api specific type method
2015-08-11 08:33:05 -07:00
Josh Lane
4af98852b8 fix warning
* don't overshadow serializer variable
2015-08-11 08:32:20 -07:00
Josh Lane
f6e3d4e1f9 allow id attribute to be overriden 2015-08-04 09:22:05 -07:00
Артём Большаков
424a053ee5 Disallow to define multiple associations at once 2015-07-31 19:15:56 +03:00
João Moura
728b8f980e Merge pull request #1026 from jfelchner/patch-1
Bump Version Number to 0.10.0.rc2
2015-07-31 11:34:42 -03:00
João Moura
c703d0f35c Merge pull request #985 from bolshakov/feature/each_association
Associations implementation refactoring
2015-07-31 10:57:03 -03:00
Jeff Felchner
e468030cbf Bump Version Number to 0.10.0.rc2
Due to the fact that users need to switch from the released version to `master` occasionally to pull in upstream bugfixes, it's important that this version number stays in sync with the released version.
2015-07-31 04:51:55 -05:00
Артём Большаков
2952a332e0 Associations refactoring
* Move all associations related code from Serializer class to Associations module
* Introduce Reflection class hierarchy
* Introduce Association class
* Rid off Serializer#each_association
* Introduce Serializer#associations enumerator
2015-07-30 11:20:29 +03:00
Benjamin Fleischer
a66df3009a Encapsulate serialization in ActiveModel::SerializableResource
Usage: ActiveModel::SerializableResource.serialize(resource, options)
2015-07-23 11:05:23 -05:00
João Moura
418721302b defining json_key(root) as model class name 2015-07-23 02:11:34 -04:00
João Moura
6266b6a002 Merge pull request #1006 from bf4/inflector-testing
Fix adapter inflection bug for api -> API
2015-07-20 23:20:00 -04:00
Benjamin Fleischer
ed23a37de9 require rails/railtie before subclassing Rails::Railtie 2015-07-17 14:16:30 -05:00
Benjamin Fleischer
4359026c0e Handle inflecting api to s/API/Api without side-effects 2015-07-17 14:09:13 -05:00
vyrak bunleang
1b09d0ec42 array serializer uses root option for json_key if available 2015-07-16 15:34:19 -06:00
Marek Pietrucha
e5ccb8e4dd root option is working (fixed #986) 2015-07-16 15:32:09 -06:00
Jiajia Wang
7faa5e8e2e Bug fix for ArraySerializer json_key
When the resource is a zero result query,
i.e. post_comments = PostComment.where("1=0")
the json_key will become 'postcomments' rather than 'post_comments'.
Using 'underscore' instead of 'downcase' fixes the error.
2015-07-15 10:11:06 +10:00
João Moura
775737619a Merge pull request #996 from bf4/serializer_lint
Add linter for serializable resource
2015-07-13 19:37:39 -04:00
Benjamin Fleischer
28174e297d Add linter for serializable resource 2015-07-09 11:20:19 -05:00
Rodrigo Ra
df63b59512 Add key option to serializer associations 2015-07-05 19:47:58 -03:00
Hugo Almeida
f25071ca70 Fixes virtual value not being used 2015-06-29 10:48:12 +09:00
João Moura
d3649d5b4e Renaming Error to NoSerializerError 2015-06-26 02:16:35 -03:00
Benjamin Fleischer
e5d1e40dbd Handle special-case of Array serializer with unserializable elements 2015-06-26 02:16:34 -03:00
Benjamin Fleischer
cf77786da2 Fix #955 2015-06-26 02:16:34 -03:00
João Moura
189b79523c fixing array rendering when elements doesn't have a serializer 2015-06-26 02:15:42 -03:00
Aaron Lerch
6892ca39c9 Default the generated cache key to use custom #strftime instead of raw #to_s to achieve more accurate precision 2015-06-25 23:40:18 -04:00
Benjamin Fleischer
2d24dded14 serializable_hash and as_json should take options = nil
per ActiveModel::Serialization#serializable_hash
96bb004fc6/activemodel/lib/active_model/serialization.rb
    def serializable_hash(options = nil)
          options ||= {}

Otherwise, passing in nil to `as_json` or `serializable_hash`
makes things blow up when passing nil into attributes
2015-06-24 11:46:29 -05:00
João Moura
e321cb366d Getting root key from AR::Relation 2015-06-16 11:36:17 -03:00
João Moura
65e0d79195 pluralising root key when using arraySerializer 2015-06-15 15:59:01 -03:00
João Moura
329691276a disabling custom root option 2015-06-15 15:58:39 -03:00
João Moura
d061b2e9f4 enabling flatten json as default adapter 2015-06-15 13:49:24 -03:00
João Moura
1ea5608e78 updating tests to match new adapters structure 2015-06-15 13:39:36 -03:00
João Moura
2e46507971 avoiding nil cases when dynamically creating a class 2015-06-15 02:50:06 -03:00
João Moura
8e1214b4c5 force to use flattenJson when dealing with ArraySerializer 2015-06-15 02:48:39 -03:00
João Moura
b2f1947d4a removing unseless root method 2015-06-14 17:24:48 -03:00
João Moura
2bf91a0c0e updating adapters to follow new root logic 2015-06-14 03:25:20 -03:00
João Moura
a0753cb0bc autoloading new flatten son adapter 2015-06-14 03:25:00 -03:00