I know there is DRY way tow rite that, but I don't remember how


residence_rentals_ids = []
residences = user.franchise.residences
 for residence in residences
     residence_rentals_ids = residence.rentals.map {|rental|
rental[:id] }.compact
end


I tried unsuccessfully :

residence_rentals_ids = user.franchise.residences.each { |residence|
residence.rentals.map { |rental| rental[:id}.compact   }

thanks for your lights

erwin