Maybe the form of my validations module is deficient…
module MyValidationsModule
extend ActiveSupport::Concern
included do
validate :some_custom_validation
end
def some_custom_validation
<references to various instance methods of parent, e.g., ref_1 &
ref_2, here>
end
end
Wow, getting fancy there. Just a little off topic question, any reason why you don’t want to use the ActiveModel::Validator module and the #validates_with helper to break-out/organize your custom validations?
…when the validations execute in the parent, they do not find the
delegated instance methods.
Any thoughts?
Sure, just a few questions. If you manually define your methods #ref_1 and #ref_2 (and just put logging code in their implementations) as opposed to using delegation methods, do they get called? Also, what is the exact error message or indication of failure? Can you provide any more code? Are the delegations to a class where the parent (that includes your validation module) has_many, has_one, or belongs_to the associated model?