As clubs is probably a relationship (ActiveRecord::Relation kind of object) you can call clubs.pluck(:id) instead of clubs.map {|c| c.id }