On Friday, April 1, 2016 at 11:21:22 AM UTC-7, Janko Marohnić wrote: > > I gave this a lot of thought, and I have one modification of my previous > idea could work, that we remove "_than": > > validates_greater > validates_greater_or_equal > validates_less > validates_less_or_equal > > The only problem is that it maybe sounds ambiguous regarding arguments, in > comparison to validates_greater_than and validates_less_than which are > explicit. >
Yes, I thought validates_greater sounded odd, so I don't think these method names would be good. > Another idea: > > validates_greater_than > validates_min[imum] > validates_less_than > validates_max[imum] > > This came to mind when I saw the existing validates_min_length and > validates_max_length validation methods. > > I thought about validates_at_least and validates_at_most, and maybe one > downside is that in english these phrases are often used in context which > is not related to numbers and inequality. But I definitely like that it's > short and simple. > Not being related to numbers a good thing in this case. There is nothing about comparable validations that are specific to numbers. It's perfectly valid to say validates_greater_than 'M' with a string column. That's not to say I'm completely happy with validates_at_most and validates_at_least. I'm hoping to find a better name. validates_min[imum] and validates_max[imum] are good ideas, and certainly no worse than validates_at_least and validates_at_most. Another option I've thought of is using a single method for all of these: validates_operator(:==, 3, :column) validates_operator(:>, 3, :column) validates_operator(:>=, 3, :column) validates_operator(:<, 3, :column) validates_operator(:<=, 3, :column) While I like the simplicity of that approach, I'm not sure it's the best way either. Thanks, Jeremy -- You received this message because you are subscribed to the Google Groups "sequel-talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/sequel-talk. For more options, visit https://groups.google.com/d/optout.
