title: Address validation during user sing up using geocoder in Ruby
body: <p>I am trying to include address validation during user sign up in ruby on rails. The user has to input their address in the form of street address, city, and zipcode. I implemented some address validation in the user controller using this:</p>
  <pre><code>    after_validation :geocode
      has_secure_password
  
      
      validates :address, presence: true
      validate :found_address_presence
  
      def found_address_presence
          if latitude.blank? || longitude.blank?
              errors.add(:address, &quot; wasn't found.&quot;)
          end
      end
  
      def full_address
          [address, city, state, zip_code, 'USA'].compact.join(', ')
      end
  </code></pre>
  <p>However, this always returns the error that the address was not found, even when the address is valid. I have confirmed that the addresses I inputed are real and work when the validation is removed. Why is this not working? It seems like the latitudes and longitudes are always blank, but they seem to be added appropriately when the address validation is removed.</p>