Rails:获取tIDENTIFIER语法错误

时间:2016-01-11 09:40:08

标签: ruby-on-rails

我在以下代码中收到错误:

<%= 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='... ... ^

我做错了什么?

提前致谢!

1 个答案:

答案 0 :(得分:1)

试试这个

<%= Warehouse.where(:product => sale.product).pluck(:price) %>