ActiveModel::Dirty Attribute Change

github logo ・1 min read

Sometimes we need to check specific attribute if change from it previous value before running an api for request limit.

The solution is activemodel::dirty

for after save


for before save



class User
  after_save api_update, if: :saved_change_to_name?
  before_save api_update, if: :will_save_change_to_position?

  def api_update

These callbacks will run only if the attributes change from its previous value.

twitter logo DISCUSS
Classic DEV Post from Oct 10 '18

How I remember CSS Grid properties

I want to share how I remember the most common CSS Grid properties. This will help you use CSS Grid without googling like a maniac.

Maynard Cabalitan profile image
Ruby on rails dev