Closed skalee closed 6 years ago
@kwkwan You're welcome to leave your comments as well, I have a feeling that you're one of the primary users of this gem.
@skalee I agree we could use a shorter version of :uri
. It would be quite unlikely that people would use two of these gems with conflicting names anyway.
If this is agreed we can go ahead. Thanks @skalee !
This one has nothing to do with gem name.
At the moment, the validator is named
UriFormatValidator
(exactly like the gem itself). Hence, models which use this validator look as follows:The current state is bit unintended, and is a result of my mistake while renaming the gem. Previously it was named
UrlValidator
and was used as follows:And perhaps we should name it
UriValidator
:I am thinking which one is better:
UriFormatValidator
orUriValidator
.The former is: – More descriptive – IMHO seems to match names of standard Rails validators bit better (I am thinking about
FormatValidator
, precisely – Less likely to collide with similar gems, as the validator name exactly matches the gem name. Yes, there are several gems with similar purpose and naming. And yes, it can happen that two or more gems of similar purpose are in the single project, typically when one comes as a dependency of yet another gem.The latter is: – Shorter, memorable, and more convenient, which is always a good thing – Validator name collision is still quite unlikely, and if happen, it can be fixed by specifying a fully qualified name of the validator (
validates :author_url, "UriFormatValidator::UriValidator" => {…}
)Change is pretty simple to do, if wanted. Your decision, @ronaldtse.