Ir al contenido

Unbounded Query No Limit (ARCH6061)

Esta página aún no está disponible en tu idioma.

Key ruby.orm.unbounded-query-no-limit · Severity info · Category orm

Fetching an entire table with no LIMIT or pagination risks memory blowup on large tables when the result feeds a list or response.

def index
render json: User.all # whole table into memory and the response
end
def index
render json: User.limit(50).offset(params[:offset].to_i)
end

Add limit and pagination to queries that feed a list/response to avoid fetching the whole table.