DEV Community

Discussion on: Rails: The Struggle Is Real

Collapse
 
mtarnovan profile image
Mihai Târnovan

Are you trolling or just link-baiting? You don't even need to define a Serializer for this...

current_user.todos
  .includes(:tags)
  .where(completed: true)
  .order(created_at: :desc)
  .limit(30)
  .to_json(only: [:name], include: :tags)