Here is a class that I used to have
class Something
# Defines the validates class methods, which is called upon instantiation
include Module
validates :name
validates :date
end
I now have several objects that are using the same functionalities, and worse, several object that are defining similar things, like this:
class Anotherthing
# Defines the validates class methods, which is called upon instantiation
include Module
validates :age
end
I want to 're-use' the content of these classes, so I turned them into modules:
module Something
# Defines the validates class methods which is called upon instantiation
include Module
validates :name
validates :date
end
module Anotherthing
# Defines the validates class methods which is called upon instantiation
include Module
validates :age
end
And I can now create a class
class ADualClass
include Something
include Anotherthing
end
The problem that I have is that the validates method are not called when I create a ADualClass object... It seems that the "validates :thing" is never called. Why is that? How can I force this?