title: Same custom validation for several fields in Rails
body: <p>I have four date_time fields in my model in Rails app. I want to apply the same validation method to them, so that only a valid date time could be accepted. Validation method is from earlier <a href="https://stackoverflow.com/questions/1370926/rails-built-in-datetime-validation">question</a> on stack overflow:</p>
  
  <pre><code>  validate :datetime_field_is_valid_datetime
  
    def datetime_field_is_valid_datetime
      errors.add(:datetime_field, 'must be a valid datetime') if ((DateTime.parse(datetime_field) rescue ArgumentError) == ArgumentError) &amp;&amp; !datetime_field.nil? &amp;&amp; !datetime_field.blank?
    end
  </code></pre>
  
  <p>Is there more elegant way to validate these fields, other than defining four exactly same methods for every DateTime field?</p>