samedi 25 avril 2015

How top pop last element of ActiveRelation?


Say I have this query:

red_houses = user.houses.where(color: 'red')

How can I pop the last element of red_houses?

I know I can do this red_houses[1..-2], but not red_houses.pop, is there any way I am missing?

Basically I want to delete the last element and get the remaining relation without the last element on it.


Aucun commentaire:

Enregistrer un commentaire