-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
3 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,8 @@ | ||
<% module_namespacing do -%> | ||
class <%= class_name %>Serializer < <%= parent_class_name %> | ||
<% if attributes.any? -%> attributes <%= attributes_names.map(&:inspect).join(", ") %> | ||
<% end -%> | ||
attributes <%= attributes_names.map(&:inspect).join(", ") %> | ||
<% association_names.each do |attribute| -%> | ||
has_one :<%= attribute %> | ||
<% end -%> | ||
end | ||
<% end -%> | ||
<% end -%> |
681bcf5
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.
Really do we have to do that? Wouldn't it be more correct to use an
ApplicationSerializer
superclass and declare it there? This isActiveModel::Serializers
. Not everyActiveModel
class has a semantic use for ID. Seems to me this is more important forActiveRecord
. So now I have to go through all my non persisted classes and remove this attribute?