I'm having a problem extending ActiveRecord with custom validations
based on the "Write Custom Validations" recipe from Advanced Rails
Recipes. As far as I can tell, I've followed the instructions exactly
but for some reason this isn't working and it's driving me crazy.
I've tried making the methods in the custom validations module class
methods (self.validates...) as well as the way they are below (which
is the way they are in the instructions).
I'm having a problem extending ActiveRecord with custom validations
based on the "Write Custom Validations" recipe from Advanced Rails
Recipes. As far as I can tell, I've followed the instructions exactly
but for some reason this isn't working and it's driving me crazy.
I've tried making the methods in the custom validations module class
methods (self.validates...) as well as the way they are below (which
is the way they are in the instructions).
Any suggestions?
Have you tried requiring it from an initializer, not the bottom of
environment.rb ?
Thanks Fred, that worked! I created config/initializers/
custom_validations.rb and moved the require line there from the
environment.rb file. It's not clear to me why this works, and it
seems like it's overkill to create a new file for this, but as long as
it works it's cool with me.
Thanks Fred, that worked! I created config/initializers/
custom_validations.rb and moved the require line there from the
environment.rb file. It's not clear to me why this works, and it