Reputation: 26008
This one works
items = Item.where(:item_id.in => items.map(&:id))
unlike these two
items = Item.where(item_id:.in items.map(&:id))
items = Item.where(item_id.in: items.map(&:id))
Is there any way to convert the first expression of "old style Ruby hash" to the "new style Ruby hash" notation?
Upvotes: 0
Views: 271
Reputation: 168071
No there isn't. The {key: value}
notation for a hash is only available when the key can be written as a symbol literal.
Upvotes: 2