I also thought about a method like validates_operator (in my mind it was named 
"validates_inequality", which probably sounds weird to non-mathematicians), but 
I thought that when reading it the order of arguments might appear strange. But 
it's really the most precise, consisent, and thus the easiest to remember. We 
don't have to think about naming, and it's easiest to implement since we can 
just use `send` and the error message can also be just one ("the 
number_of_games is not >= 0").

After thinking about it, I'm the most in favour of "validates_operator".

Regards,
Janko

> On 02 Apr 2016, at 00:22, Jeremy Evans <[email protected]> wrote:
> 
> 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 a topic in the Google 
> Groups "sequel-talk" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/sequel-talk/EMrbjLFrJpA/unsubscribe 
> <https://groups.google.com/d/topic/sequel-talk/EMrbjLFrJpA/unsubscribe>.
> To unsubscribe from this group and all its topics, send an email to 
> [email protected] 
> <mailto:[email protected]>.
> To post to this group, send email to [email protected] 
> <mailto:[email protected]>.
> Visit this group at https://groups.google.com/group/sequel-talk 
> <https://groups.google.com/group/sequel-talk>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
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.

Reply via email to