Skip to content

Instantly share code, notes, and snippets.

View Carto_BackEnd_test.md

Ejercicio 1:

  • 2 querys en total gracias al eager loading del preload
  • En la app de RoR se crearían scopes en modelos y Query Objects para encapsular las responsabilidades para evitar potenciales smells
users = User
	.select('users.id, users.name, users.created_at, COUNT(groups_users.group_id) AS count_groups')
	.joins('users LEFT OUTER JOIN groups_users ON users.id=groups_users.user_id')