Skip to content

Instantly share code, notes, and snippets.

@nlinn
Created April 28, 2020 07:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nlinn/fbd0ee2fcabe67ecacefa68de731bb2d to your computer and use it in GitHub Desktop.
Save nlinn/fbd0ee2fcabe67ecacefa68de731bb2d to your computer and use it in GitHub Desktop.
Unexpected validation result
class DoSomething < ActiveInteractor::Base
def perform
end
end
class DoSomethingContext < ActiveInteractor::Context::Base
attribute :my_attribute
validates :my_attribute, presence: true, on: :calling
end
result = DoSomething.perform(my_attribute: nil)
result.success?
# => false (expected)
result.valid?
# => true (unexpexted!)
result.errors.any?
# => false (unexpexted!)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment