title: API Call to validate a field before save, would this be done on a before_save or inside the controller?
body: <p><strong>Preface:</strong></p>
  
  <p>In my application I have a model named <code>Order</code>, which contains a third party <code>order_id</code> that I need to validate before saving. To verify the id is correct, I make an API call to their order verification endpoint.</p>
  
  <p><strong>Question:</strong></p>
  
  <p>Where exactly I should perform this verification in a rails app? My first logical choice was the controller:</p>
  
  <pre><code>  def create
      order_id = params[:joint_membership_application][:order_id]
  
      # API call to check order status, true = order ID is verified
      if @client.order_valid?(order_id)
        @membership_app = JointMembershipApplication.create!(membership_app_params)
  
      # ...
    end
  </code></pre>
  
  <p>But I'm always reading that business logic should live inside the models, not the controllers. Would it be bad practice to make an API call inside a <code>before_save</code> callback for the model? If I placed this logic in the model, I would need to instantiate an API client on save which seems a bit weird.</p>
  
  <p>I may very well be overthinking this, but wanted to hear from people with rails experience on where exactly I should be performing this sort of verification. Thanks!</p>