私は次のような文字列変数を持っています:
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" ])
文字列変数を検索条件に入れる正しい方法は何ですか?