1

我对过滤姓氏的索引进行了测试,测试通过了:

it "finds transactions with a given customer last_name" do
  customer = create :customer, last_name: "Merp"
  t2 = create :transaction, location_id: @location.id
  t1 = create :transaction, location_id: @location.id, customer_id: customer.id
  get :index, last_name: "merp"
  assigns(:transactions).should eq [t1]
end

这是该问题控制器的重要部分:

# => @filter = {:customers=>{:last_name=>"merp"}}
# => @joins = [:customer]
@transactions = Transaction
  .joins(@joins)
  .where(@filter)

但是当我在开发环境中手动进行测试时,它只返回区分大小写的匹配(注意测试不是大小写匹配)。

为什么我在实际使用页面时使用不区分大小写的搜索通过了测试,而在不区分大小写的搜索中操作失败?

4

0 回答 0