[katello-devel] Moving validators to models/validators

Dmitri Dolguikh dmitri at redhat.com
Tue Feb 5 13:39:49 UTC 2013


On 05/02/13 12:56 PM, Petr Chalupa wrote:
>
>
> On 05.02.13 11:50, Dmitri Dolguikh wrote:
>> To minimize the number of cross-module dependencies (and ensuing
>> rabbit-hole trips) I propose:
>>   - move model-related validators into app/model/validators
>
> This means all the validators in `lib/validators` since they are all 
> descendants of ActiveModel::Validator or ActiveModel::EachValidator, 
> right?
>
>>   - move controller-related validators (should there be any) into
>> app/controllers/validators
>
> AFAIK there are none. If they will be I would choose different name to 
> avoid confusion.
>
>>   - mark validators by adding "_validator" and "Validator" suffixes to
>> filenames and classes correspondingly
>
> It may be redundant since all validators are in directory `validators` 
> and in namespace `Validators`.

This allows for simple location of validators in various ide's - you can 
filter files by pattern (ctrl-shift-n in RubyMine, for example), as not 
all tools are capable of doing lookups by class names (ctrl-n in RubyMine).

-d
>
>>   - should the number of validator classes in the locations suggested
>> above grow too big, break down the validation modules further (possibly
>> along the lines of app/models/validators/user/username_validator)
>> -d
>>
>> _______________________________________________
>> katello-devel mailing list
>> katello-devel at redhat.com
>> https://www.redhat.com/mailman/listinfo/katello-devel
>
> _______________________________________________
> katello-devel mailing list
> katello-devel at redhat.com
> https://www.redhat.com/mailman/listinfo/katello-devel




More information about the katello-devel mailing list