我是 Rails 新手,我正在尝试使用 where 方法从我的数据表中检索记录。但是,使用它似乎不会返回任何结果。
employee = Employee.where("first_name = ?", "bill") #doesn't work
employee = Employee.where(:first_name => "bill") #doesn't work
employee = Employee.find_by_first_name("bill") #works
我正在通过打印来测试结果employee.first_name
,就像我说的前两个不返回任何东西,而第三个返回“账单”。这里发生了什么?