zhishi-engine/zhishi-backend

View on GitHub
app/models/concerns/model_json_hash_helper.rb

Summary

Maintainability
A
0 mins
Test Coverage
module ModelJSONHashHelper
  def user_and_comment_attributes
    {
      comments: {
        only: [:content],
        include: user_attributes
      },
    }.merge(user_attributes)
  end

  def user_attributes
    {
      user: { only: [:name, :email] }
    }
  end
end