Commit Graph

22 Commits

Author SHA1 Message Date
Benjamin Fleischer
772b7999c5 Better AMS Model attributes interface 2016-11-21 09:14:26 -06:00
Mark Abramov
5f3bdcc87c Use ActiveSupport::Cache.expand_cache_key for cache key expansions (#1878)
* Use ActiveSupport::Cache.expand_cache_key for cache key expansions
2016-08-13 16:59:36 -05:00
L. Preston Sego III
aa4d89ab47 remove dynamic class creation where not needed (#1850)
* remove dynamic class creation where not needed
2016-07-18 14:11:09 -05:00
Benjamin Fleischer
f4e00dc65d Merge pull request #1815 from dubadub/making-rubocop-happy
Fix code-styling issues from .rubocop_todo.yml

* re: RuboCop: Bulk minor style corrections

* re: RuboCop - hash indention corrections

* re: RuboCop - replace rocket style hashes

* re: RuboCop - get rid of redundant curly braces around a hash parameter

* re: RuboCop - Align the elements of a hash literal if they span more than one line.

* re: RuboCop - Use nested module/class definition instead of compact style.

* re: RuboCop - Suppress of handling LoadError for optional dependencies

* re: RuboCop - use include_ prefix instead of has_

* re: RuboCop - Disable Style/PredicateName rule for public API methods

* re: RuboCop - Remove empty .rubocop_todo.yml

* re: RuboCop - replace rocket style hashes
2016-06-26 22:22:55 -05:00
zaaroth
bcf3358524 Ensuring read_multi works with fragment cache. (#1814)
* Ensuring read_multi works with fragment cache.
2016-06-22 22:33:02 -05:00
Alexey Dubovskoy
f15f6850de re: RuboCop: Bulk minor style corrections 2016-06-20 22:12:16 +01:00
Benjamin Fleischer
5375e009e2 Test caching with fragmented key
- on association, fix up assocation logic
- on attribute
2016-06-07 20:26:38 -05:00
Benjamin Fleischer
b8924157d7 Remove remaining fragmented cache class 2016-06-07 03:42:03 -05:00
Benjamin Fleischer
35a7c81034 Fix up caching, especially fragment_cache 2016-06-07 00:52:05 -05:00
Benjamin Fleischer
913f396bb1 Move adapter cache properties to class level (where they belong). 2016-06-04 15:00:51 -05:00
Benjamin Fleischer
ee518e1856 Remove unnecessary Adapter::Base#cache_attributes 2016-06-01 00:35:11 -05:00
Lucas Hosseini
f48fd2a327 Extract IncludeTree. (#1685) 2016-05-28 10:07:11 -04:00
Benjamin Fleischer
1e10c20ac0 Consolidate and simplify caching code 2016-04-13 01:08:09 -05:00
kevintyll
16a3f93ce9 Include adapter in cache key
Confirm caching attributes with different key json_api vs. attributes adapter

Adapted from @kevintyll's original test
https://github.com/rails-api/active_model_serializers/pull/1644#issuecomment-204147094
2016-04-01 00:52:28 -05:00
Benjamin Fleischer
4ba4c298ec Prefer object.cache_key when available. 2016-03-31 22:29:13 -05:00
kevintyll
ab6bd600e3 When caching, return the object's cache_key up front if it's defined.
This will prevent objects PORO objects that don't have updated_at defined, from throwing an error.

Not as big a deal now that PORO objects can inherit ActiveModelSerializers::Model, but still necessary if it's not inherited for whatever reason.

Add the Adapter type to the cache key.

This prevents incorrect results when the same object is serialized with different adapters.

BF:

Cherry-pick of
040a97b9e9
which was a squash of
f89ed71058

from pr 1346
2016-03-31 22:29:13 -05:00
Benjamin Fleischer
d50d29b601 Cleaning up Caching Tests 2016-03-30 09:53:21 -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
Benjamin Fleischer
355e0f6a37 Merge branch 'lserman-master'
Followup needed:
- Update code comments https://github.com/rails-api/active_model_serializers/pull/1622#discussion_r57750471
- Move test class into test scope https://github.com/rails-api/active_model_serializers/pull/1622#discussion_r57659150
2016-03-29 21:50:27 -05:00
Logan Serman
d0389ca765 Fix fragment caching inherited serializers to use distinct per-serializer caches. 2016-03-28 16:26:51 -05:00
Benjamin Fleischer
c3c69a607a Separate enabling of caching and setting the cache store 2016-03-24 22:20:42 -05:00
Benjamin Fleischer
eda8ff1737 Move serializer caching from adapter 2016-03-13 19:57:59 -05:00