Universe::Animals.wild.types.find { |x| x[:legs] == 4 }
Rails在扔
Relation#all is deprecated. If you want to eager-load a relation, you can call #load (e.g. `Post.where(published: true).load`). If you want to get an array of records from a relation, you can call #to_a (e.g. `Post.where(published:true).to_a`)'
如何重构此语句以删除弃用警告。不希望抑制弃用
1条答案
按热度按时间d7v8vwbk1#
1.它告诉你!
you can call #to_a (e.g. Post.where(published:true).to_a)
1.别这样!
将获取一个具有4条腿的Animals示例-假设腿是一个列而不是一些自定义方法。