Adding custom validations to active record

sa 125 wrote:

I saved it in lib/custom_validations.rb, and tried including it in the top of my environment.rb to extend AR:

include 'custom_validations' class ActiveRecord::Base   include CustomValidations end

#.. rest of file

Sadly, this won't work.

Always include even a snip of the error message you got. After your detailed writeup, just claiming "won't work" leaves us bereft of closure!

However, the top of environment.rb might be before "require 'active_record'". That means 'class' would introduce 'ActiveRecord', leaving 'Base' as a missing identifier. If so, move it to the bottom!