_before_type_cast woes

I introduced a transient attribute to my model to capture something
that’s not in the model. I added an

attr_accessor :attr

line for it in the model, and manage to do a few validates_* checks on
it successfully … BUT as soon as I add validates_numericality, I get
an error

attr_before_type_cast method not found (or something close to that)

I assume it has something to do with the following line in

record.errors.add(attr_name, configuration[:message]) unless
record.send("#{attr_name}_before_type_cast").to_s =~ /^[±]?\d+$/

My question is, how to do this kind of validation (or any other that
may rely on _before_type_cast) on a non-model attribute ?