我有一个字符串变量如下:
the_style = @house.style # this is a string variable and contains the value "modern"
如果我在数据库中搜索如下:
Building.find(:last, :conditions => [" style = ?", "#{the_style}" ])
我收到上述错误,但是如果我在字符串值中硬编码它可以工作:
Building.find(:last, :conditions => [" style = ?", "modern" ])
将字符串变量放入查找条件的正确方法是什么?