0
洗劫搜索做工精細一些屬性:洗劫搜索和排序不能與某些屬性的工作
Spree::Callback.all.ransack(name_cont: 1).result
SELECT "spree_callbacks".* FROM "spree_callbacks" WHERE ("spree_callbacks"."name" ILIKE '%1%')
而且不要與他人合作...
Spree::Callback.all.ransack(phone_cont: 1).result
SELECT "spree_callbacks".* FROM "spree_callbacks"
有什麼不對?
P.S.回調是在施普雷模塊我的自定義模型
而且例如回調對象:
Spree::Callback.first
Spree::Callback Load (1.4ms) SELECT "spree_callbacks".* FROM "spree_callbacks" ORDER BY "spree_callbacks"."id" ASC LIMIT 1
=> #<Spree::Callback:0x00000009eb68c0 id: 39,
phone: "123",
comment: "",
created_at: Wed, 12 Jul 2017 03:37:03 UTC +00:00,
updated_at: Wed, 12 Jul 2017 03:41:34 UTC +00:00,
name: "123",
processed: true>
'self.whitelisted_ransackable_attributes || =%(重量)[電話]' – nuT707
您好@ nuT707 'self.whitelisted_ransackable_attributes | =%(重量)[電話]'這將添加'phone'到列入白名單的陣列,只有當它不存在前在陣列中。例如:這個紅寶石OR運算符 Ex。 a = [1,2,3] a | = [2,4] => [1,2,4] 您在這裏使用memoization的地方。 '|| ='是用於記憶的用戶 Ex。 a = [1,2,3] a || = [2,4] => [1,2,3] –
我收到** true **,而不是數組 – nuT707