When using Objects returned by the ActiveRecord collection proxy, using a loop if fine in a view, but sometimes I want to turn just one of the hash' common attributes into an array. I find I'm doing it a lot, which results in what appears to be somewhat verbose:
forum_roles = []
@forum #=> [{id: 0, name: 'a'},{id: 1, name: 'b'}]
@forum.each do |role|
forum_roles << role.name
end
forum_roles #=> ['a','b']
Just wondering if there's an easier way to arriving at ['a','b']