Why is this method protected? (from agile book)

I think the response is twofold. As for AWDRv2, I think the point of the chapter is to demonstrate the different ways that validation can be added to a model. The first dozen or so chapters are dedicated to a somewhat real world example. Take them for what they are, realizing that you might want to do things differently.

As for your specific question, "validate" is a protected method of ActiveRecord::Base. If you want to extend it (the point of the AWDR example) then you've got to implement the full signature of the method, including it's 'protectedness'.

HTH, AndyV

Because it never should be called from outside the context of the model.


Dave Thomas