Commit Graph

58 Commits

Author SHA1 Message Date
Michał Zając
dcc7af925d Update serializers.md 2016-04-11 14:52:07 +02:00
Benjamin Fleischer
afe3c93807 Add more association documentation (#1635)
[DOC] Add more association documentation
2016-04-10 12:44:37 -05:00
Ben Mills
3498647d1a Apply key transforms to keys referenced in values 2016-04-04 10:16:04 -06:00
Chris Peters
dba85f2720 #1594 - Document generator's auto-extending of (if it exists) 2016-04-02 13:18:07 -04:00
Krzysztof Rybka
37e0fdb0ee Remove wrong quoting in serializers guide 2016-03-31 14:56:07 +02:00
Benjamin Fleischer
fa7b3afbfd Prefer explicitly yielding the serializer, per groyoh 2016-03-30 14:01:28 -05:00
Yohan Robert
21cb896802 Move SerializableResource to ActiveModelSerializers namespace
Ref. https://github.com/rails-api/active_model_serializers/pull/1310
2016-03-30 11:33:04 +02:00
Ben Mills
bfff46b66e Add output examples to Adapters docs 2016-03-17 14:07:32 -06:00
Jeffrey Wan
297e1f7e9d Update docs regarding overriding the root key 2016-03-17 10:54:22 -06:00
L. Preston Sego III
88d4fe5b5e Merge pull request #1431 from beauby/deserialization-docs
Add docs for deserialization.
2016-03-17 12:48:55 -04:00
L. Preston Sego III
586ff09cc5 Added more detailed examples to deserialization.md from json_api/deserialization.rb 2016-03-17 07:58:51 -04:00
Ben Mills
9e992358d8 Merge pull request #1574 from remear/key-casing
Provide key transformation
2016-03-15 13:42:24 -06:00
Marc Garreau
045fa9bc07 Adds polymorphic tests and documentation 2016-03-15 13:09:59 -06:00
Ben Mills
c533d1a7fe Provide key case translation 2016-03-15 12:21:10 -06:00
Krzysztof Rybka
7c3f0ec6af Remove wrong quoting in serializers guide 2016-03-14 15:00:46 +01:00
Benjamin Fleischer
26b089c881 Add serialization_scope example [ci skip] 2016-03-12 19:59:43 -06:00
Ben Mills
4219844c12 Add resource-level meta docs. Update top-level meta docs. 2016-03-08 20:47:22 -07:00
Ben Mills
cc10928472 Provide Rails url_helpers via SerializationContext 2016-03-07 10:40:34 -07:00
Benjamin Fleischer
25c9df0b97 Merge branch 'master' into domitian-move-namespace-of-adapter-to-active-model-serializers
Conflicts:
	CHANGELOG.md
	lib/active_model/serializer/adapter/attributes.rb
	lib/active_model/serializer/adapter/cached_serializer.rb
	lib/active_model/serializer/adapter/fragment_cache.rb
	lib/active_model/serializer/adapter/json_api.rb
	lib/active_model/serializer/adapter/json_api/link.rb
	test/adapter/fragment_cache_test.rb
	test/adapter/json_api/links_test.rb
	test/adapter/json_api/resource_type_config_test.rb
2016-02-23 23:21:49 -06:00
bobba surendranath chowdary
252f9c4ae9 Moved the adapter and adapter folder to active_model_serializers folder and changed the module namespace
Changed the namespace in adapters and folder to active_model_serializers from active_model::serializer

Changed namespace of adapters in serializers and other folders

Moved adapter_for_test file to active_model_serializers folder and changed namespace of adapter inside the test file

Require ActiveSupport's string/inflections

We depend on string/inflections to define String#underscore.

Refactor JsonApi adapter to avoid redundant computations.

Update readme.md to link to v0.10.0.rc4

changed namespace of adapter folder testcases

Changed all namespaces of adapter under active_moder_serializers

Namespaced IncludeTree which is from serializer module, so needed to namespace it properly

Fixed wrong namsepacing of fieldset

namespace change in deserializer json_api

Fixed the namespace for collection serializer when used inside adapter, changed namespace for adapter to new namespace which I had forgotten previously

Modified logging test and adapter test cases to make the testcases pass

Changed the yardoc links,as old links are not taking to documentation pages,proper links for 0.10,0.9 and 0.8 in rubydoc

Rubocop errors are fixed by underscore naming unused variables

Moved the require of adapter to serializable resource

Remoeved adapter dependency inside serializer and added warning to Serializer::adapter method

Fixed frament cache test which is calling Serializer.adapter

Changed the name of lookup_adapter_from_config to configured_adapter

Changed the docs which will show the new namespace of adapters

Rubocop fix
2016-02-23 21:49:58 -06:00
Yohan Robert
727d7631ae Add symbol support for ActiveModel::Serializer.type method
The ActiveModel::Serializer.type method now accepts symbol as paremeter:
class AuthorSerializer < ActiveModel::Serializer
  type :profile
end
The test file for the type was also refactored.
2016-02-19 17:05:13 +01:00
Benjamin Fleischer
5b953ff40f Address concerns from #1018 commit c59668e 2016-02-08 17:55:15 -06:00
Peter Wagenet
efdd466147 Namespace is included in auto-registered adapters [ci skip] 2016-01-28 15:48:18 -08:00
Peter Wagenet
75fdbfa992 Adapters inherit from Adapter::Base 2016-01-28 14:27:53 -08:00
Nate Sullivan
0a937a0fba Use new block-based attribute override in docs 2016-01-23 18:59:18 -08:00
Nate Sullivan
da85d944d4 Remove unrelated code from attribute override examples 2016-01-23 18:50:18 -08:00
Benjamin Fleischer
8981683b9f Merge pull request #1352 from bf4/railties
Fix generators (@dgynn); load Railtie only with Rails, ensures caching configured
2016-01-18 23:24:40 -05:00
Lucas Hosseini
f2d59b20ca Update rendering.md 2016-01-17 16:58:35 +01:00
Benjamin Fleischer
d3bdc9be57 Replace load hook :active_model_serializers with :action_controller 2016-01-15 01:58:14 -06:00
Benjamin Fleischer
92e8a0a246 Merge pull request #1417 from koryteg/custom_root_docs
[DOCS] added documentation for adding custom root
2016-01-15 00:52:56 -06:00
Benjamin Fleischer
dde843d162 Add serialization docs PR request note for conditional attributes 2016-01-13 10:19:07 -06:00
Lucas Hosseini
3aeb34b0b8 Add docs for deserialization. 2016-01-13 08:40:38 +01:00
Kory Tegman
aeefb6a080 revised docs to reflect the feedback 2016-01-06 22:21:19 -08:00
Kory Tegman
d153dfe2cd added documentation for adding custom root 2016-01-06 15:57:49 -08:00
CorainChicago
66b068c542 fix link on Getting Started
update link on Getting Started to use the relative path
2015-12-29 22:52:22 -06:00
Benjamin Fleischer
fce856fc83 Merge pull request #1371 from bf4/documentation_updates
[DOCS] Refactor, update, create documentation
2015-12-20 22:30:44 -06:00
Benjamin Fleischer
13c9a90fa5 Fix grammar per nullvoxpopli [ci skip] 2015-12-16 12:56:55 -06:00
Benjamin Fleischer
9c3431db9e Fix grammar per duduribeiro [ci skip] 2015-12-15 21:34:25 -06:00
Benjamin Fleischer
51af5a4b76 fix typo caught by duduribeiro 2015-12-15 21:29:39 -06:00
Benjamin Fleischer
ce17a1b305 [DOCS] Refactor, update, create documentation [ci skip] 2015-12-14 14:38:29 -06:00
Benjamin Fleischer
28394340d8 Add config.serializer_lookup_enabled that defaults true 2015-11-30 00:20:58 -06:00
Trek Glowacki
170db3ba88 Allow users to globally opt out of automatic lookup 2015-11-30 00:15:02 -06:00
Benjamin Fleischer
d1c44c719d Update for review per maurogeorge feedback 2015-11-19 12:41:51 -06:00
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
Lucas Hosseini
831921ff07 Update adapters.md
Fix typos.
2015-10-31 18:51:10 +01:00
Lucas Hosseini
9147469842 Extend serializer lookup to the parent serializer. 2015-10-08 18:23:54 +02:00
Benjamin Fleischer
9d7da8afc4 Add support for top level jsonapi member. 2015-10-01 21:22:49 -05:00
Benjamin Fleischer
c6f8d0f5f2 Rename FlattenJson to Attributes (allow plural adapter names) 2015-09-18 10:17:02 -05:00
Benjamin Fleischer
0091be89f8 Consistently refer to the 'JSON API' and the 'JsonApi' adapter 2015-09-17 15:22:28 -05:00