Skip to content
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

Merged
merged 1 commit into from
Mar 30, 2016

Conversation

lserman
Copy link
Contributor

@lserman lserman commented Mar 25, 2016

Fixes #1621

@groyoh
Copy link
Member

groyoh commented Mar 25, 2016

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 fixes section?

@@ -139,6 +139,11 @@ def slug
belongs_to :author
end

InheritedRoleSerializer = Class.new(RoleSerializer) do
Copy link
Member

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?

@bf4
Copy link
Member

bf4 commented Mar 27, 2016

@lserman awesome work! Please address comments, squash down to one commit, and this is ready to merge! 💯

@lserman lserman reopened this Mar 28, 2016
@lserman
Copy link
Contributor Author

lserman commented Mar 28, 2016

@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
Copy link
Member

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

@bf4
Copy link
Member

bf4 commented Mar 29, 2016

@lserman 💯 you're doing a fantastic job!

@@ -79,10 +79,12 @@ def add_attributes_to_serializer(serializer, attributes, attributes_keys)
# User_AdminCachedSerializer
Copy link
Member

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 😉

@bf4 bf4 merged commit d0389ca into rails-api:master Mar 30, 2016
bf4 added a commit that referenced this pull request Mar 30, 2016
Followup needed:
- Update code comments #1622 (comment)
- Move test class into test scope #1622 (comment)
@bf4
Copy link
Member

bf4 commented Mar 30, 2016

Merged! 🌈 @lserman

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants