Q:

Removing Space in my table field using Active Record

My Table named SubSituationType has a name field. It has space at the end of the name. 
For Eg: 
SubSituationType.all.collect(&:name) gives 

["Pos/Neg Space - Design ", "Pantone Match ", .....]
I need to remove the space for all such values. How to do it? 

A:

SubSituationType.all.map { |type| type.name.strip } 

And it's better to use .pluck over .all:
SubSituationType.pluck(:name).map(&:strip)

