title: Incorrect pluralizing of column name when creating foreign key
body: <p>I'm having a strange problem with Rails 4.2.4. I am creating a new table, which references some others, like this:</p>
  <pre><code>t.references :local, index: true, foreign_key: true, null: false
  t.references :serie, index: true, foreign_key: true, null: false
  </code></pre>
  <p>when I execute the migration, there is an error when creating the foreign key constraint:</p>
  <blockquote>
  <p>PG::UndefinedColumn: ERROR:  no existe la columna «series_id» referida en la llave foránea</p>
  </blockquote>
  <p>which is Spanish for</p>
  <blockquote>
  <p>PG::UndefinedColumn: ERROR: column «series_id» referenced in foreign key constraint does not exist</p>
  </blockquote>
  <p>meaning there is no &quot;series_id&quot; column in the created table. Of course, it shouldn't be any column with that name.</p>
  <p>The correct column name the generation of FK should be looking for is &quot;serie_id&quot;, and it does exist.</p>
  <p>Now the strangest thing is that it doesn't fail for :local, for instance. It doesn't look for &quot;locales_id&quot;, but &quot;local_id&quot; which is correct, and the corresponding FK is created.</p>
  <p>I have custom Spanish inflections, and correct pluralizations are:</p>
  <blockquote>
  <p>local -&gt; locales</p>
  <p>serie -&gt; series</p>
  </blockquote>
  <p>however I don't understand why the FK generation seems to be pluralizing in one case and not in the other.</p>
  <p>I have found a working solution in <a href="https://stackoverflow.com/a/2430026/2553863">this answer</a>, which is declaring specifically the foreign keys, like:</p>
  <pre><code>add_foreign_key :turnos_registrados, :series, column: :serie_id
  </code></pre>
  <p>but what I'd like to know is why is this happening.</p>