-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor fragment cache methods #1527
Conversation
3f9d26c
to
fac4521
Compare
@@ -23,7 +23,8 @@ Fixes: | |||
- [#1501](https://github.com/rails-api/active_model_serializers/pull/1501) Adds tests for SerializableResource::use_adapter?,doc typos (@domitian) | |||
- [#1488](https://github.com/rails-api/active_model_serializers/pull/1488) Require ActiveSupport's string inflections (@nate00) | |||
|
|||
Misc: | |||
Misc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
accidental :
removal
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah true!
Looks awesome! |
fac4521
to
8276f0a
Compare
@groyoh would love you to also look at
|
def cached_attributes(klass, serializers) | ||
attributes = serializer.class._attributes | ||
cached_attributes = (klass._cache_only) ? klass._cache_only : attributes.reject { |attr| klass._cache_except.include?(attr) } | ||
def cached_attributes(serializers) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like this method should really be called cache_attributes
as it is neither idempotent nor does it is a Query; rather it is a Command
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and I suppose these are really something like fragmented_serializers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Completely agree on this. 👍
needs rebase :-) |
8276f0a
to
05a5b87
Compare
:) |
Damn, I'm conflicting with myself now 😄 |
05a5b87
to
20a2cf3
Compare
Rebased again :) |
20a2cf3
to
fcdbaa5
Compare
Removed extra calls to constantize and DRY'd the code.
fcdbaa5
to
580139f
Compare
Damn I messed up with this one, will reopen when I fix it. |
Removed extra calls to constantize and DRY'd the code.