title: Checking if variable exists in Rails 5 GET request
body: <p>Not sure exactly how to ask this as I am learning as I go.  I am creating/updating user information from my app to a third party CRM system. 
   I have two methods that run successfully with an <code>after_save</code> callback.  During testing, I would comment one out so I can test the other but now I need to combine them with an if else statement.</p>
  
  <p>What should happen when combined together is when <code>User</code> is saved, the system will see if a user exists on the CRM system - <code>if agile_id?</code>.  If user exists, it will skip down to the update call and send over any updated contact data, but if it doesn't, it will create a new CRM contact record.</p>
  
  <p><strong>The error I am receiving in the browser is:</strong></p>
  
  <pre><code>undefined method `agile_id?' for #&lt;User:0x007ffe24cef318&gt;
  </code></pre>
  
  <p><strong>user.rb</strong></p>
  
  <pre><code>...
  after_save :sync_to_agilecrm
  ...
  def sync_to_agilecrm
      agile_id = AgileCRM.request :get, 'contacts/search/email/'+email, nil
      if agile_id?
        contact_data = {
            'properties': [
                { 'type': 'SYSTEM', 'name': 'first_name', 'value': first_name },
                { 'type': 'SYSTEM', 'name': 'last_name', 'value': last_name },
                { 'type': 'SYSTEM', 'name': 'email', 'subtype': 'work', 'value': email },
                { 'type': 'SYSTEM', 'name': 'address', 'value': '{\"address\":\"225 George Street\",\"city\":\"NSW\",\"state\":\"Sydney\",\"zip\":\"2000\",\"country\":\"Australia\"}' },
            ]
        }
        parsed_contact_data = JSON.parse(contact_data.to_json)
        print(AgileCRM.request :post, 'contacts', parsed_contact_data)
      else
        update_contact_data = {
            'id': agile_id,
            'properties': [
                { 'type': 'SYSTEM', 'name': 'first_name', 'value': first_name },
                { 'type': 'SYSTEM', 'name': 'last_name', 'value': last_name },
                { 'type': 'SYSTEM', 'name': 'email', 'subtype': 'work', 'value': email },
                { 'type': 'SYSTEM', 'name': 'address', 'subtype': 'work', 'value': address_line1 },
            ]
        }
        parsed_update_contact_data = JSON.parse(update_contact_data.to_json)
        print(AgileCRM.request :put, 'contacts/edit-properties', parsed_update_contact_data)
      end
    end
  ...
  </code></pre>