Skip to content

Instantly share code, notes, and snippets.

@sled sled/example1.rb Secret
Created Apr 21, 2016

Embed
What would you like to do?
Create = Dry::Validation.Form do
key(:organization_id).required
key(:code).required
rule(:unique_code_organization) do
!Code.exists?(code: value(:code), organization_id: value(:organization_id))
end
configure do
option :market_repo, WheelsApp.instance["repositories.market"]
end
end
Create = Dry::Validation.Form do
key(:organization_id).required
key(:code).required(:uniq?)
rule(:unique_code_organization) do
!Code.exists?(code: value(:code), organization_id: value(:organization_id))
end
configure do
option :market_repo, WheelsApp.instance["repositories.market"]
def uniq?(code)
!Code.exists?(code: code, organization_id: value(:organization_id))
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.