problem with select

I have this statement ids = athlete.leagues.select("league_id").map(&league_id)

getting this error Fixnum (expected Proc)"

Anyone know what is going on here?

by the way not a girl :slight_smile: gerbdla = gerber david los angeles long story.

What is it that youโ€™re trying to do with this statement? The closest i can guess is the following:

ids = athlete.leagues.select{|league|league.id = league_id}.map(&:league_id)

But that just gives an array of league_ids the same as the one you started with.

Instead this worked. Not sure exactly why the other works and not select.

athlete.leagues.collect(&:league_id)

because ".select" returns only those elements that return true to an evaluation, while ".collect" returns the result of the block passed to every element. Have a look at the Enumerable and Array api pages.