I'd like to capitalize the first_name
and last_name
of my model instances using the before_save
method. Of course I could do this:
before_save do
self.first_name = first_name.capitalize
self.last_name = last_name.capitalize
end
But I'd much rather alter the two attributes in one fell swoop. Is there a way to select certain columns in my model and apply the desired method to them?