ActiveRecord::Validations::ClassMethods.evaluate_condition missing in Rails 2.1.0 ???

Hi,

I have trustfully updated my Rails-Application from 2.0.2 to 2.1.0 and stumbled over the fact, that a public interface method simply has disappeared!

I use a custom validation I wrote myself which gets mixed into Activerecord::Base. The validation uses the class method 'evaluate_condition' of ActiveRecord::Validations::ClassMethods. This worked fine as of rails 2.0.2; Now I get the error 'method not found' when I use the validation. The method really does not exist anymore.

I use the method as suggested in many places for the evaluation the :if-clause of my validator.

Is there any replacement for this method? How do I solve this problem?

And also some general questions: How can it be that interface methods get silently deleted in a minor release step ?? And, even worse, not document it anywhere or provide a way for the user to bring their source up to date ?? I have searched myself silly, and not found any hint on this issue...

Am I the only one running into that? I can hardly believe that....

Thank you for helping,

Regards, Jörg

Hi,

I have trustfully updated my Rails-Application from 2.0.2 to 2.1.0 and stumbled over the fact, that a public interface method simply has disappeared!

I use a custom validation I wrote myself which gets mixed into Activerecord::Base. The validation uses the class method 'evaluate_condition' of ActiveRecord::Validations::ClassMethods. This worked fine as of rails 2.0.2; Now I get the error 'method not found' when I use the validation. The method really does not exist anymore.

Refactored into ActiveSupport::Callbacks. Looks like more of an implementation detail to me, it's unfortunate it was ever public (given that there were no tests for that specific function it doesn't look like it was intended as a public interface).

Fred

Hi Fred,

Thank you for your fast answer!

Actually, the scope in which I use it is in a validator that gets mixed into ActiveRecord::Base, so actually it would not even need to be public (Am I wrong?). But since I have seen this method being used in many examples for custom made validators this refactoring should be documented somewhere and how people have to rewrite their code.

How do I have to rewrite my validator now?

Here's what I used with 2.0.2:

Hi Fred,

Thank you for your fast answer!

Actually, the scope in which I use it is in a validator that gets mixed into ActiveRecord::Base, so actually it would not even need to be public (Am I wrong?). But since I have seen this method being used in many examples for custom made validators this refactoring should be documented somewhere and how people have to rewrite their code.

How do I have to rewrite my validator now?

I'd have a look at what other validations do. When you've got your
head around it write it up somewhere :slight_smile:

Fred