# encoding: utf-8

class VarietyValidator < ActiveModel::EachValidator

  def validate_each(record, attribute, value)

    previous_value   = record.send("#{attribute}_was")
    force_change     = record.send("force_#{attribute}_change")

    if previous_value && (force_change == true) && (options == true)
      record.errors[attribute] << "cannot be the same as before" if (previous_value.downcase == value.downcase)
      return false
    end

  end

end

Add a variety validator to check if a record is not set to the same value as it was before.
Add a variety validator to check if a record is not set to the same value as it was before.
