Benjamin Fleischer
21bb306d38
Keep Logging in the ActiveModelSerializers namespace
2015-11-10 03:09:24 -06:00
Mauro George
51424963da
ActiveSupport::Notifications render.active_model_serializers
...
Squashed commits:
Add Logging
Generates logging when renders a serializer.
Tunning performance on notify_active_support
- Use yield over block.call
- Freeze the event name string
Organize the logger architeture
* Keep only the `ActiveModel::Serializer.logger` to follow the same public API we
have for example to config, like `ActiveModel::Serializer.config.adapter` and
remove the `ActiveModelSerializers.logger` API.
* Define the logger on the load of the AMS, following the Rails convention on
Railties [1], [2] and [3].
This way on non Rails apps we have a default logger and on Rails apps we will
use the `Rails.logger` the same way that Active Job do [4].
[1]: 2ad9afe4ff/activejob/lib/active_job/railtie.rb (L9-L11)
[2]: 2ad9afe4ff/activerecord/lib/active_record/railtie.rb (L75-L77)
[3]: 2ad9afe4ff/actionview/lib/action_view/railtie.rb (L19-L21)
[4]: 2ad9afe4ff/activejob/lib/active_job/logging.rb (L10-L11)
Performance tunning on LogSubscriber#render
Move the definition of locals to inside the `info` block this way the code is
executed only when the logger is called.
Remove not needed check on SerializableResource
Use SerializableResource on ActionController integration
On the ActionController was using a adapter, and since the instrumentation is
made on the SerializableResource we need to use the SerializableResource over
the adapter directly. Otherwise the logger is not called on a Rails app.
Use SerializableResource on the ActionController, since this is the main
interface to create and call a serializer.
Using always the SerializableResource we can keep the adapter code more easy to
mantain since no Adapter will need to call the instrumentation, only the
SerializableResource care about this.
Add docs about logging
Add a CHANGELOG entry
Keep the ActiveModelSerializers.logger
Better wording on Logging docs
[ci skip]
Add doc about instrumentation
[ci skip]
Use ActiveModel::Callbacks on the SerializableResource
2015-11-10 03:09:24 -06:00
tchak
31172b1be5
rename context to serialization_context
2015-11-07 20:32:27 +01:00
Paul Chobert
6407dbeadd
Add test and bugfix to include an array of string
2015-11-06 17:23:25 +01:00
Lucas Hosseini
8ac2b9b01f
Minor cleanup.
2015-11-03 23:59:12 +01: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
L. Preston Sego III
17be650538
Revert "rename context to serialization_context and add url helpers"
2015-10-29 08:16:47 -04:00
L. Preston Sego III
a063cbea21
Merge pull request #1289 from tchak/serialization_context
...
rename context to serialization_context and add url helpers
2015-10-29 07:56:47 -04:00
L. Preston Sego III
48b041ecae
Merge pull request #1294 from beauby/fix-serializer-lookup-non-ams
...
Only use subclasses of ActiveModel::Serializer during lookup.
2015-10-25 23:01:00 -04:00
Lucas Hosseini
b5aecfd114
Initialize fieldset.
2015-10-25 19:56:43 +01:00
Lucas Hosseini
13ef8fed1b
Fix fields option to restrict relationships as well.
2015-10-24 21:28:13 +02:00
Lucas Hosseini
1a42345d84
Only use subclasses of ActiveModel::Serializer during lookup.
2015-10-23 17:17:03 +02:00
tchak
d08ee5994f
rename context to serialization_context and add url helpers
2015-10-22 22:28:54 +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
737784c9b7
Merge pull request #1272 from bf4/add_public_poro_base
...
Add PORO serializable base class: ActiveModelSerializers::Model
2015-10-20 12:50:05 -05:00
Benjamin Fleischer
124faaa829
Add PORO serializable base class: ActiveModelSerializers::Model
2015-10-14 21:33:02 -05:00
Benjamin Fleischer
8529ea43c9
Handle no serializer source file to digest.
...
output warning
Closes #1176
2015-10-14 20:56:29 -05:00
João Moura
da7e6dc795
Merge pull request #1247 from beauby/jsonapi-toplevel-links
...
Add support for toplevel JSON API links.
2015-10-10 17:52:08 -03: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
Benjamin Fleischer
49eb531539
Merge pull request #1239 from beauby/fix-duplicate-jsonapi
...
Fix duplicate resources inside included in compound document.
2015-10-08 14:19:02 -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
54303b6290
Add support for toplevel JSON API links.
2015-10-06 20:01:46 +02:00
Lucas Hosseini
f4bb4c81b0
Fix duplicate resources between data and included.
2015-10-06 17:25:27 +02: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
Lucas Hosseini
34d65716cb
Merge pull request #1214 from NullVoxPopuli/issue/1211-failing-test
...
Fix #1211 , include_tree is null when using the key: options
2015-10-02 15:29:04 +02:00
Liam Bowen
f8323fc9e5
Fixes #1211 - retrieve the key from the reflection options when building associations
2015-10-02 08:52:21 -04: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
35473cf983
Merge pull request #1186 from bf4/empty_else
...
Enforce case requires else; allow else nil
2015-09-21 17:48:27 +02:00
Lucas Hosseini
606e2ae337
Merge pull request #1127 from NullVoxPopuli/support-nested-associations-for-json-adapter
...
Support nested associations for Json and Attributes adapters + Refactor Attributes adapter
2015-09-21 17:20:29 +02:00
Benjamin Fleischer
1d8a3d039a
Enforce case requires else; allow else nil
2015-09-21 09:50:53 -05:00
L. Preston Sego III
a74ea189cd
Refactors of the Attribute adapter. Adds support for nested associations specified from the include key in the controller. Adds some tests and some method documentation
2015-09-21 10:35:47 -04:00
L. Preston Sego III
8f2dd66710
Merge pull request #1183 from rails-api/block_style
...
Update Rubocop todo
2015-09-21 01:25:50 -05:00
Lucas Hosseini
4976837c31
Fix options passing in Json and Attributes adapters.
2015-09-21 07:13:17 +02:00
Benjamin Fleischer
140b4f2735
Update Rubocop todo
2015-09-21 00:11:08 -05:00
Benjamin Fleischer
ca6b193fcb
Enforce Rails-style (line-count-based) block style
2015-09-21 00:00:53 -05:00