title: Create object with relationship in Salesforce with Restforce using Rails
body: <p>I use Ruby on Rails 4.2.5 with the Restforce gem for Salesforce API. I create a <code>Contact</code> in my controller :</p>
  
  <pre><code>class CandidateFormController &lt; ApplicationController
  
  
    def index
      client = Restforce.new(
        :username =&gt; ENV['SALESFORCE_USERNAME'],
        :password       =&gt; ENV['SALESFORCE_MDP'],
        :security_token =&gt; ENV['SALESFORCE_TOKEN'],
        :client_id      =&gt; ENV['SALESFORCE_APIKEY'],
        :client_secret  =&gt; ENV['SALESFORCE_SECRET'],
      )
  
      new_client = client.create('Contact', FirstName: @first_name,
        LastName: @last_name,
        Email: @email,
        MobilePhone: @telephone,
        Description: @champ_libre,
        Profil_LinkedIN__c: @linkedin
       )
  
    end
  
  end
  </code></pre>
  
  <p>I have a relationship between two of my tables.
  <code>Candidate</code> is associated to <code>Opportunity</code> (a job offer if you prefer), and the <a href="https://github.com/ejholmes/restforce" rel="nofollow noreferrer">restforce documentation</a> doesn't explain how to create a new entry with a relation between two elements, or if it does I am not enough experimented to have understand how am I supposed to do so.</p>
  
  <p>I have not enough credit to post screenshots, but if this is necesseray I can use imgur or something like that.</p>
  
  <p>P.S : I already see <a href="https://stackoverflow.com/questions/23753066/how-to-get-all-associated-data-with-the-salesforce-account-object-in-ruby-on-rai">this post</a> on the subject, but that didn't help me at all.</p>