When a Trailblazer operation is defined by inheritance, it inherits its superclass's contract:
class Create < Trailblazer::Operation
contract do
...
end
...
end
class Update < Create
...
end
Can an inherited Trailblazer operation's contract alter validations defined by its superclass ?
This question arose because a create operation's contract defined a mandatory property that needed to be optional in the update operation:
validates :foo, presence: true
The initial thought was to somehow reverse this definition in the inherited class but there didn't appear to be a way to do this (it is possible to ignore a property in the subclass (writeable:false
- book p61) but there appears to be no way to change its validity criteria).