我在以下代码中收到错误:
<%= Warehouse.where(:product sale.product).pluck(:price) %>
实际上,如果Warehouse.product == sale.product,它应该打印价格。但事实并非如此。我收到了这个错误:
SyntaxError in OrdersController#show
syntax error, unexpected tIDENTIFIER, expecting ')' ...= Warehouse.where(:product sale.product).pluck(:mrr) );@outp... ... ^
syntax error, unexpected ')', expecting keyword_end ...uct sale.product).pluck(:mrr) );@output_buffer.safe_append='... ... ^
我做错了什么?
提前致谢!
答案 0 :(得分:1)
试试这个
<%= Warehouse.where(:product => sale.product).pluck(:price) %>