def format_property_value(attr, type)
      return unless send(attr.to_sym).present?

      case type.to_sym
      when :integer
        send("#{attr.to_sym}=", send(attr.to_sym).to_i)
      when :float
        send("#{attr.to_sym}=", send(attr.to_sym).to_f)
      when :boolean
        send("#{attr.to_sym}=", ActiveModel::Type::Boolean.new.cast(send(attr.to_sym)))
      else
        raise ArgumentError, 'Supported types are :boolean, :integer, :float'
      end
    end
def format_property_value(attr, type)
      return unless send(attr.to_sym).present?

      case type.to_sym
      when :integer
        send("#{attr.to_sym}=", send(attr.to_sym).to_i)
      when :float
        send("#{attr.to_sym}=", send(attr.to_sym).to_f)
      when :boolean
        send("#{attr.to_sym}=", ActiveModel::Type::Boolean.new.cast(send(attr.to_sym)))
      else
        raise ArgumentError, 'Supported types are :boolean, :integer, :float'
      end
    end
Converts the type of the property.

 Example:
   format_property_value :weight, :float

 is equivalent to:
   self.weight = weight.to_f if weight.present?