I’m trying to specify validations with ActiveModel::Validations at the
module level, i.e., I wish to mix-in validations to a module. I am not
succeeding at this, however. How do I mix-in ActiveModel::Validations
into another module and use its methods just as I would in a class?
I’m trying to specify validations with ActiveModel::Validations at the
module level, i.e., I wish to mix-in validations to a module. I am not
succeeding at this, however. How do I mix-in ActiveModel::Validations
into another module and use its methods just as I would in a class?
I’m not sure what you mean. Do you want want to put a shared set of
validations in a module or create a module that when included adds a
set of validations (among other things)
I seek to create Ruby modules that use ActiveModel::Validations. The
examples I have seen of ActiveModel::Validations all involve including
that module in classes. This is not what I want. I want to involve the
use of ActiveModel::Validations in a module, which I may then choose to
implement as a ruby class (even if after a few more descents via other
modules.)
In short, how do I do get to do the following (or its equivalent) in a
module?
Thanks, that did the trick, and I think it unlikely that I would have
found that without some help!
Now, on to what is likely the subject of yet another post: How do I
obtain the effect of ActiveModel::Validations#validates_associated if
applied to non-ActiveRecord classes where I seek to obtain nested
validations when the given class is composed of multiple Ruby objects…
G
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.