-1

我有以下关联:

Restaurant has_many Menus 
Menu belongs_to Restaurant
Restaurant belongs_to City 
City has_many Restaurants

执行以下查询时:

Menu.includes(:restaurant).where("restaurants.city_id", 3)我收到以下错误:

ActiveRecord::StatementInvalid: PG::Error: ERROR:  argument of WHERE must be type boolean, not type integer

我在这里做错了什么?

4

1 回答 1

1

这不是.where. 你要.where("restaurants.city_id = ?", 3)

于 2013-05-07T17:29:22.517 回答