I'm trying to create validations, where it only allows values that are in an array.
validates_inclusion_of :valid_number, :in =>[1,2,3,4,5,6,7,8,9,10]
That works, but what I want is something like this
numbers = [1,2,3,4,5,6,7,8,9,10]
validates_inclusion_of :valid_number, :in => numbers
When I type that I always get a NoMethodError. This leads me to believe maybe I need a different type of variable (instance, class, global).
Just a heads-up, I know there's a way to validate numericality in a range, but that's not what I'm looking for. I just picked numbers because it was quicker to type.