I have a special operation in my model that I don’t want a specific after_update
callback to run only in that situation. Is it possible?
Sample code
class User
after_update :foo, unless: -> { validation_context == :special }
def special_operation
save(context: :special)
end
def foo
puts "some code"
end
end
What I got
foo
ran because validation_context
is nil
.
What I want
foo
does not run.
Is it even possible?