jeudi 30 juin 2016

Pluck hash in rails

Is there pluck for a hash?

I have a hash like below and I tried to pluck with following command. I know that it can be done in different ways. But I dunno if there's a pluck method with the following.

hash = {"0"=>{"user_id"=>"1"}, "0"=>{"user_id"=>"2"}}
hash.pluck("user_id")

Aucun commentaire:

Enregistrer un commentaire