flash-gordon on release-1.5
flash-gordon on master
Fix typo The text mentions `.d… Merge pull request #91 from Spo… (compare)
require_relative 'app/container' require_relative 'app/transaction' require_relative 'app/operation' require_relative 'app/import' if ENV['RACK_ENV'] == 'test' require 'dry/system/stubs' App.enable_stubs! end App.finalize! do |container| # Boot the app config before everything else container.start :app_config container.start :i18n end require_relative 'app/api'
require “my_app/container”, this will leave it un-finalized and allow you to add the stubs support
FalseBolean = Types::Bool.constructor do |value| value || false end
In Dry::Validation, is there a way to define a custom error message for a rule block, that isn't composed of messages from the individual predicates used in the block? I have a form where I want to enforce a checkbox only if the birthdate given in another field is for a person under 18:
rule(acknowledge_age_if_young: [:acknowledge_age, :birth_date]) do |acknowledge_age, birth_date| birth_date.older?(18) | acknowledge_age.true? end
But the automatic error message is a join of the older?-message and the true?-message, with " or " as the delimiter: "must be older than 18 or must be true". I can customize each of these messages, but I don't see how/if I can use a message without an " or ". Basically I just wan't to say "You need to check this box if you're not 18".
Could someone clarify for me the purpose of
user_type = Types.Constructor(User) # It is equivalent to User.new(name: 'John') user_type[name: 'John’]
What is the differentce between
user_type — other than that you can construct with
Types.Instance makes sense to me, since we’re checking that the value passed is an instance of a certain class. But what are we checking with a constructor type?