Without a stacktrace here's what I suggest:
Assuming your has_one method name is products_pedidos
, your issue looks like a problem with your hash syntax.
Your syntax creates a hash with key products_pedidos
that returns a hash without a value. This is probably where the error is occurring.
@pedidos = Pedido.includes(:products_pedidos => { :product_size })
What you likely want is this which returns a hash with key products_pedidos
with value product_size
@pedidos = Pedido.includes({products_pedidos: :product_size })
The Entire query might look like:
@pedidos = Pedido.includes(
:pedidos_payments,
{products_pedidos :product_size},
:estado,
:brand,
:customer
).where(is_quote: false)
Here's a great post explaining a bit more about ActiveRecord nested relationship loading: Rails - Nested includes on Active Records?. I'd also suggest fixing the naming on products_pedido to follow good naming practices.