title: How to change validates_numericality_of into validate on rails
body: <p>How do I change</p>
  
  <pre><code>validates_numericality_of :test, :greater_than_or_equal_to=&gt;0 
  </code></pre>
  
  <p>into validate form</p>
  
  <p>I tried only character and nil values. I need to check also it must be greater than 0</p>
  
  <pre><code>validate change_test
  
  def change_test
    if @test.nil?
       errors.add_to_base('Hi Test should be only number')
    end
  end
  </code></pre>
  
  <p>and also I tried like this,</p>
  
  <pre><code>validate change_test
  
  def change_test
    if @test.nil?
       errors.add_to_base('Hi Test should be only number')
    else
      if @test &lt; 0
       errors.add_to_base('The number should be greater than or equal to 0')
      end
    end
  end
  </code></pre>
  
  <p>but it is result in error </p>
  
  <p>Please help to solve this problem</p>
  
  <p><strong><em>thanks all</em></strong> </p>