I have a big question, I am a beginner in Ruby, and I am not able to print the value of a field in my view, the result is that.
My Model:
class Pedido < ActiveRecord::Base
has_many :produtos
scope :waiting, -> { where(status: 1) }
end
My Controller:
class Backoffice::PedidosController < BackofficeController
def index
@pedidos = Pedido.waiting
end
end
And in my View it looks like this:
<tbody>
<% @pedidos.each do |pedido| %>
<tr>
<th><%=pedido.id%></th>
<th><%=pedido.status%></th>
<th><%=pedido.created_at%></th>
<th><%=pedido.produtos.select(:valor) %></th>
</tr>
<% end %>
</tbody>
I've tried it in several ways and it always prints what's in print, if I change the line to
<% = order.products.product% >
The error on the page.
Can someone give me a light?