bobba surendranath chowdary
68f09e59c4
Fixed a documentation error regarding adapter key constant, added tests
...
for SerializableResource::use_adapter?
2016-02-08 15:27:56 +05:30
Lucas Hosseini
f6fe0c8aa3
Extract links and type-related methods to their own module.
2016-01-12 15:05:39 +01:00
Lucas Hosseini
fd06a8ad0d
Extract caching into its own module.
2015-12-28 02:53:49 +01:00
Benjamin Fleischer
30fd9d9eb7
Merge pull request #1353 from bf4/disable_serializer_lookup
...
Allow users to globally opt out of automatic serializer lookup
2015-12-20 20:04:16 -06:00
Benjamin Fleischer
3e8290a923
Serializer instance methods don't change; track at class level
...
Per groyoh
https://github.com/rails-api/active_model_serializers/pull/1356#discussion_r46713503
2015-12-04 13:31:34 -06:00
Benjamin Fleischer
036604b149
Extract Serializer Attributes into its own file
2015-12-02 17:45:42 -06:00
Benjamin Fleischer
eceb2d5598
Refactor serializer attribute objects
2015-12-02 17:33:57 -06:00
Benjamin Fleischer
8804d758ef
Remove dynamically defined instance methods
2015-12-02 17:20:22 -06:00
Benjamin Fleischer
0bf45ec2a7
Small refactor to Serializer::_attribute_mappings
2015-12-02 17:20:22 -06:00
Noah Silas
7bde7bf752
Handle conflicts between key names and serializer methods
...
As an example, all serializers implement `#object` as a reference to the
object being esrialized, but this was preventing adding a key to the
serialized representation with the `object` name.
Instead of having attributes directly map to methods on the serializer,
we introduce one layer of abstraction: the `_attributes_map`. This hash
maps the key names expected in the output to the names of the
implementing methods.
This simplifies some things (removing the need to maintain both
`_attributes` and `_attribute_keys`), but does add some complexity in
order to support overriding attributes by defining methods on the
serializer. It seems that with the addition of the inline-block format,
we may want to remove the usage of programatically defining methods on
the serializer for this kind of customization.
2015-12-02 17:20:22 -06:00
Lucas Hosseini
7cbef1b3b5
Add inline syntax for defining associations
...
Adapted from
https://github.com/rails-api/active_model_serializers/pull/1262
2015-12-02 17:20:22 -06:00
Benjamin Fleischer
6020450fe4
Allow specifying attributes with a block
...
Adapted from https://github.com/rails-api/active_model_serializers/pull/1262
2015-12-02 17:20:22 -06:00
Benjamin Fleischer
87d18e9c32
Map attributes to Attribute values when defined in serializer
2015-12-02 17:20:22 -06:00
Randy Stauner
90fa377040
Match file paths with spaces in caller regexp
2015-12-02 06:17:34 -07:00
Benjamin Fleischer
28394340d8
Add config.serializer_lookup_enabled that defaults true
2015-11-30 00:20:58 -06:00
Benjamin Fleischer
a9ce4fb766
Move caching initialization to Railtie
...
Also
- Add reference to config from ActiveModelSerializers.config
- correctly call super in FragmentCacheTest#setup
- rename test rails app from Foo to ActiveModelSerializers::RailsApplication
2015-11-25 21:56:01 -06:00
Lucas Hosseini
3804dcc238
Add support for resource-level JSON API links.
2015-11-03 23:50:16 +01:00
Lucas Hosseini
0948c4199a
Compute only requested attributes.
2015-10-31 19:20:53 +01:00
Lucas Hosseini
1a42345d84
Only use subclasses of ActiveModel::Serializer during lookup.
2015-10-23 17:17:03 +02:00
Benjamin Fleischer
274cb66d34
Edits per beauby [ci skip]
2015-10-22 10:31:21 -05:00
Lucas Hosseini
63317699f3
Correct minor typos
2015-10-22 10:31:21 -05:00
Benjamin Fleischer
80e75202ea
Document Serializer and FragmentCache
2015-10-22 10:31:21 -05:00
Benjamin Fleischer
2c8b9b796d
Rename ArraySerializer to CollectionSerializer for clarity
2015-10-21 16:53:26 -05:00
Benjamin Fleischer
8529ea43c9
Handle no serializer source file to digest.
...
output warning
Closes #1176
2015-10-14 20:56:29 -05:00
L. Preston Sego III
6018ef16c4
Merge pull request #1225 from beauby/nested-serializer-lookup
...
Add support for nested serializers
2015-10-09 10:12:08 -04:00
Benjamin Fleischer
f52ade25aa
Merge pull request #1255 from bf4/serialize_inheritable_attributes
...
Make more class attributes inheritable
2015-10-09 03:10:28 -05:00
Lucas Hosseini
9147469842
Extend serializer lookup to the parent serializer.
2015-10-08 18:23:54 +02:00
L. Preston Sego III
d5e6e3148a
Merge pull request #1254 from bf4/remove_useless_access_modifier
...
Remove unnecessarily silenced warnings
2015-10-07 07:22:15 -04:00
Benjamin Fleischer
0f50847c7d
Make more class attributes inheritable
2015-10-07 06:07:22 -05:00
Benjamin Fleischer
dc44b136aa
Remove unnecessarily silenced warnings
2015-10-07 05:54:57 -05:00
Rodrigo Ra
5706e7d7fe
serializer inherits cache configuration
2015-10-07 00:34:21 -03:00
Lucas Hosseini
503bfe9598
Move meta/meta_key handling inside adapter.
2015-10-05 19:06:50 +02:00
L. Preston Sego III
3fe343f240
Merge pull request #1232 from beauby/move-root-to-adapter
...
Extract attributes filtering from serializer into adapter.
2015-10-05 12:56:54 -04:00
Lucas Hosseini
658810e6a0
Extract attributes filtering from serializer into adapter.
2015-10-05 08:21:26 +02:00
Lucas Hosseini
7847d05ecb
Remove root_name class method from Serializer, as it is used nowhere.
2015-10-05 07:27:13 +02:00
Benjamin Fleischer
a2bfe190e3
Merge pull request #1050 from bf4/json_api_member
...
Add top-level jsonapi member to JSON API adapter
2015-10-01 23:03:11 -05:00
Ivan Yurov
2dd569ae51
Add Serializer 'type' directive to control type field, for use by the JsonApi adapter
2015-10-01 22:48:57 -04:00
Benjamin Fleischer
9d7da8afc4
Add support for top level jsonapi member.
2015-10-01 21:22:49 -05:00
Lucas Hosseini
e552e4329b
Fix.
2015-09-23 18:59:32 +02:00
Lucas Hosseini
ac06013aeb
Add support for wildcard includes + improve perfs on JsonApi includes.
2015-09-21 05:58:00 +02:00
Benjamin Fleischer
ad2ca3b45c
Remove Adapter autoloads in favor of require
...
Adapters must be eager loaded to ensure they are defined
before they are used as namespacing.
cf6a074a1c (diff-41f2b3509d33e1c65bb70ee0ec7a2eea)
2015-09-18 12:44:53 -05:00
L. Preston Sego III
24a5f3843e
Merge pull request #1171 from shicholas/require_statements
...
add require statements to top of file
2015-09-18 02:27:23 -04:00
Nicholas Shook
7f17ec8afa
bring back autoload - fix test
2015-09-17 22:03:22 -07:00
Benjamin Fleischer
484426ce17
Delegate Serializer.attributes to Serializer.attribute
2015-09-17 22:11:57 -05:00
Nicholas Shook
444b4cd1d8
all require
2015-09-17 14:06:55 -07:00
Nicholas Shook
faa56482d1
full require
2015-09-17 14:06:55 -07:00
Nicholas Shook
6bdb4a13e2
removed autoload statements
2015-09-17 14:06:54 -07:00
Nicholas Shook
a9e3143c19
add require statements to top of file
...
Based on
https://github.com/rails-api/active_model_serializers/issues/1170#issuecomment-141184047
2015-09-17 14:06:54 -07:00
Benjamin Fleischer
9d65f0adc5
Distinguish options ivar from local; Extract latent Adapter::CachedSerializer
2015-09-17 10:45:09 -05:00
Lucas Hosseini
ce7a839f3d
Extended format for JSONAPI include option.
2015-09-13 22:45:47 +02:00