<%- serializer_name = [@namespace, class_name].compact.join('::') -%>
class <%= serializer_name %>Serializer < SimpleJsonApi::ResourceSerializer
  serializes :<%= class_name.underscore.pluralize %>, model: <%= @model %>, primary_key: :<%= @model.constantize.primary_key %>

  <%- @model.constantize.column_names.each do |col| -%>
  attribute :<%= col %>
  <%- end -%>

  <%- @model.constantize.reflect_on_all_associations.each do |assoc| -%>
  <%= assoc.macro %> :<%= assoc.name %>
  <%- end -%>
end

<%- serializer_name = [@namespace, class_name].compact.join('::') -%>
class <%= serializer_name %>Serializer < SimpleJsonApi::ResourceSerializer
  serializes :<%= class_name.underscore.pluralize %>, model: <%= @model %>, primary_key: :<%= @model.constantize.primary_key %>

  <%- @model.constantize.column_names.each do |col| -%>
  attribute :<%= col %>
  <%- end -%>

  <%- @model.constantize.reflect_on_all_associations.each do |assoc| -%>
  <%= assoc.macro %> :<%= assoc.name %><%= ', polymorphic: true' if assoc.options[:polymorphic] %>
  <%- end -%>
end

Include flag for polymorphic associations
Include flag for polymorphic associations
