Abhishek Abhishek - 11 months ago 45
Ruby Question

Ruby sql to trim an entire column in a model

I have a location model with an attribute name.
I want to trim(remove extra white spaces) the entire name attribute.

I tried to run


But it isnt working. is the query wrong?


This is what you are looking for:

Location.update_all('name = TRIM(name)')