title: How do I set an _id value in FactoryBot that isn't a foreign key?
body: <p>I'm using FactoryBot (formerly FactoryGirl) to create some factory data for my tests. I have a model that looks like this via the schema (stripped down to just the relevant stuff):</p>
  
  <pre><code>create_table "items", force: :cascade do |t|
      t.text "team"
      t.text "feature_id"
      t.text "feature"
      t.timestamps
  end
  </code></pre>
  
  <p>However, <code>feature_id</code> and <code>feature</code> are NOT references to a feature object... they are just strings.</p>
  
  <p>I've defined my factory like this:</p>
  
  <pre><code>FactoryBot.define do
    factory :item do
      team "TheTeam"
      sequence(:feature_id) {|n| "Feature#{n}" }
      feature { Faker::Lorem.sentence }
    end
  end
  </code></pre>
  
  <p>And the simple case works:</p>
  
  <pre><code>&gt; FactoryBot.create(:item)
  =&gt; #&lt;Item:0x007fad8cbfc048
   id: 1,
   team: "TheTeam",
   feature_id: "Feature1",
   feature: "Qui voluptatem animi et rerum et.",
   created_at: Wed, 10 Jan 2018 02:40:01 UTC +00:00,
   updated_at: Wed, 10 Jan 2018 02:40:01 UTC +00:00&gt;
  </code></pre>
  
  <p>But when I want to specify my own <code>feature_id</code> this is what happens:</p>
  
  <pre><code>&gt; FactoryBot.create(:item, feature_id: "123")
  =&gt; #&lt;Item:0x007fad8d30a880
   id: 2,
   team: "TheTeam",
   feature_id: "123",
   feature: nil,
   created_at: Wed, 10 Jan 2018 02:40:59 UTC +00:00,
   updated_at: Wed, 10 Jan 2018 02:40:59 UTC +00:00&gt;
  </code></pre>
  
  <p>You can see that <code>feature</code> is now <code>nil</code>. I'm assuming this is because it's trying to infer that <code>feature_id</code> and <code>feature</code> are somehow related. But in this case, I don't want them to be.</p>
  
  <p><strong>Is there a better way to define the factory so that it just treats them as unrelated fields?</strong></p>
  
  <p>BTW, if I try to set both the <code>feature_id</code> and <code>feature</code> it looks like this:</p>
  
  <pre><code>&gt; FactoryBot.create(:item, feature_id: "123", feature: "hi")
  =&gt; #&lt;Item:0x007fad8d262810
   id: 3,
   team: "TheTeam",
   feature_id: nil,
   feature: nil,
   created_at: Wed, 10 Jan 2018 02:45:01 UTC +00:00,
   updated_at: Wed, 10 Jan 2018 02:45:01 UTC +00:00&gt;
  </code></pre>
  
  <p>So it just sets both fields to <code>nil</code>. I suspect FactoryBot is trying to be "smart" about these fields based on their names. I'd change them but they are already set that way in the Db.</p>