See if column value is updated

I have a complex user model with a validation method

before_validation_on_update :geocode_places 

This check geocodes the "places" column in my user table every time an update occurs.

The problem is that this validation takes a lot of time. Is there a way to trigger this check only after updating the places column? It looks like "before_validation_on_column_update", so to speak.

+6
ruby ruby-on-rails activerecord
source share
1 answer

There are a number of methods available for this. For example, self.places_changed? must work.

Check out the docs for more.

+8
source share

All Articles