From: Ryan Davis Date: 2011-09-02T05:32:46+09:00 Subject: Re: help on find over find On Sep 1, 2011, at 11:31 , Mauricio Alcayaga wrote: > @activityPeriods = coleccion.map{ |x| [x.date_created.year, > x.date_created.month] }.uniq > > as you can see, I'm getting an array of two columns [years, months] > extracted from a collection's (named "coleccion") asking over the field > "date_created" > > question: do you know a way, using similar structure, to introduce a > variable as field name to generate the response ? , I mean in te way of: > > @activityPeriods = coleccion.map{ |x| [x.VARIABLEFIELDNAME.year, > x.VARIABLEFIELDNAME.month] }.uniq I'm not sure I entirely understand your question... but I think you want to look at Object.send.