-
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
Use serializer name instead of model name to create fragment cache serializers #1622
Conversation
Thanks for this PR! I've been wanting to roll it out myself for quite some time now. Could you add an entry within the CHANGELOG in the |
@@ -139,6 +139,11 @@ def slug | |||
belongs_to :author | |||
end | |||
|
|||
InheritedRoleSerializer = Class.new(RoleSerializer) do |
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.
Could you move this class to test/cache_test.rb
to avoid bloating this file?
@lserman awesome work! Please address comments, squash down to one commit, and this is ready to merge! 💯 |
@bf4 thank you, hope I did that squash right... never done this before. |
InheritedRoleSerializer = Class.new(RoleSerializer) do | ||
cache key: 'inherited_role', only: [:name, :special_attribute] | ||
attribute :special_attribute | ||
end |
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.
Better to include this in the class CacheTest
so it's not in the global scope, but not a blocker
@lserman 💯 you're doing a fantastic job! |
@@ -79,10 +79,12 @@ def add_attributes_to_serializer(serializer, attributes, attributes_keys) | |||
# User_AdminCachedSerializer |
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.
The doc should also be changed accordingly 😉
Followup needed: - Update code comments #1622 (comment) - Move test class into test scope #1622 (comment)
Merged! 🌈 @lserman |
Fixes #1621