def preference_value_changed?(name, old, value)
        definition = preference_definitions[name]
        if definition.type == :integer && (old.nil? || old == 0)
          # For nullable numeric columns, NULL gets stored in database for blank (i.e. '') values.
          # Hence we don't record it as a change if the value changes from nil to ''.
          # If an old value of 0 is set to '' we want this to get changed to nil as otherwise it'll
          # be typecast back to 0 (''.to_i => 0)
          value = nil if value.blank?
        else
          value = definition.type_cast(value)
        end
        
        old != value
      end
def preference_value_changed?(name, old, value)
        definition = preference_definitions[name]
        if definition.type == :integer && (old.nil? || old == 0)
          # For nullable numeric columns, NULL gets stored in database for blank (i.e. '') values.
          # Hence we don't record it as a change if the value changes from nil to ''.
          # If an old value of 0 is set to '' we want this to get changed to nil as otherwise it'll
          # be typecast back to 0 (''.to_i => 0)
          value = nil if value.blank?
        else
          value = definition.type_cast(value)
        end
        
        old != value
      end
Determines whether the old value is different from the new value for the
 given preference.  This will use the typecasted value to determine
 equality.