search for: validates_inclus

Displaying 2 results from an estimated 2 matches for "validates_inclus".

2006 Jun 21
3
validation help
I would like to validate a number within a certain range. To first test that a entry is a valid number i use validates_numericality_of :my_number, :message =>''sorry, not a number'' to test if the number is within a certain range i use validates_inclusion of :my_number, :in => min..max, message => ''outside range!'' If the numericality test fails, I don''t want to do the second range test, otherwise both error messages will be displayed. At the moment, both tests with be performed regardless. Any ideas on how to...
2013 Nov 14
6
validates :boolean_field, presence: true misconceptions
...cern about the naming of ''presence'' . Instead of changing the behaviour of the presence validator, I was wondering if maybe the answer to avoid such misconceptions could be to create a new validator called presence_of_boolean that abstracts the sometimes called "hacky" validates_inclusion in: [true, false] What do you guys think? Sergio Campamá -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-core+unsubscribe@googleg...