如何在SQLite中的嵌套Ruby中转义引号?

如何在SQLite中的嵌套Ruby中转义引号?,sql,ruby-on-rails,ruby,sqlite,Sql,Ruby On Rails,Ruby,Sqlite,我试图从数据库中的菜单表中提取数据。 假设x是一家餐厅的名称: x = Applebee's 在我的控制器中,我尝试提取满足用户选择标准的特定食物项目(因此在本例中,选择的卡路里为750,选择的类别为鸡肉,因此这些被传递到参数中): @items=Menu.where(“卡路里我会做一些更像 @items = Menu.where( "calories <= :calories AND category = :category AND restaurant = :restaura

我试图从数据库中的菜单表中提取数据。 假设x是一家餐厅的名称:

x = Applebee's
在我的控制器中,我尝试提取满足用户选择标准的特定食物项目(因此在本例中,选择的卡路里为750,选择的类别为鸡肉,因此这些被传递到参数中):


@items=Menu.where(“卡路里我会做一些更像

@items = Menu.where(
    "calories <= :calories AND category = :category AND restaurant = :restaurant", 
    {calories: params[:calories], category: params[:category], restaurant: x}
)
@items=Menu.where(
“卡路里试试这个

@items = Menu.scoped
@items = @items.where("calories <= (?)", params[:calories])
@items = @items.where(:category => params[:category])
@items = @items.where(:restaurant => x)
@items=Menu.scoped

@items=@items.where(“这对我有用,这是您提供的第二个解决方案,谢谢!
@items = Menu.scoped
@items = @items.where("calories <= (?)", params[:calories])
@items = @items.where(:category => params[:category])
@items = @items.where(:restaurant => x)
@items = Menu.where(
           "calories <= (?)", params[:calories]
         ).where(
           :category => params[:category]
         ).where(
           :restaurant => x
         )