{"action":"opened","issue":{"url":"https://api.github.com/repos/rails/rails/issues/19643","labels_url":"https://api.github.com/repos/rails/rails/issues/19643/labels{/name}","comments_url":"https://api.github.com/repos/rails/rails/issues/19643/comments","events_url":"https://api.github.com/repos/rails/rails/issues/19643/events","html_url":"https://github.com/rails/rails/issues/19643","id":66238920,"number":19643,"title":"ActiveRecord::Migration table.references() ignores ActiveRecord::Base.pluralize_table_names = false","user":{"login":"erikj","id":20881,"avatar_url":"https://avatars.githubusercontent.com/u/20881?v=3","gravatar_id":"","url":"https://api.github.com/users/erikj","html_url":"https://github.com/erikj","followers_url":"https://api.github.com/users/erikj/followers","following_url":"https://api.github.com/users/erikj/following{/other_user}","gists_url":"https://api.github.com/users/erikj/gists{/gist_id}","starred_url":"https://api.github.com/users/erikj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/erikj/subscriptions","organizations_url":"https://api.github.com/users/erikj/orgs","repos_url":"https://api.github.com/users/erikj/repos","events_url":"https://api.github.com/users/erikj/events{/privacy}","received_events_url":"https://api.github.com/users/erikj/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-04-03T22:19:14Z","updated_at":"2015-04-03T22:19:14Z","closed_at":null,"body":"It appears that in **Rails** / **ActiveRecord** `4.2.1`, that the `references` column \"type\" ignores `ActiveRecord::Base.pluralize_table_names` or doesn't work as expected when configured to `false`:\r\n\r\n```sh\r\n$ grep plural config/environment.rb\r\nActiveRecord::Base.pluralize_table_names = false\r\n```\r\n\r\n```sh\r\n$ rails generate model foo\r\n      invoke  active_record\r\n      create    db/migrate/015_create_foo.rb\r\n      create    app/models/foo.rb\r\n      invoke    minitest\r\n      create      test/models/foo_test.rb\r\n      create      test/fixtures/foos.yml\r\n\r\n$ rails generate model bar foo:references\r\n      invoke  active_record\r\n      create    db/migrate/016_create_bar.rb\r\n      create    app/models/bar.rb\r\n      invoke    minitest\r\n      create      test/models/bar_test.rb\r\n      create      test/fixtures/bars.yml\r\n\r\n$ cat db/migrate/015_create_foo.rb\r\nclass CreateFoo < ActiveRecord::Migration\r\n  def change\r\n    create_table :foo do |t|\r\n\r\n      t.timestamps null: false\r\n    end\r\n  end\r\nend\r\n\r\n$ cat db/migrate/016_create_bar.rb\r\nclass CreateBar < ActiveRecord::Migration\r\n  def change\r\n    create_table :bar do |t|\r\n      t.references :foo, index: true, foreign_key: true\r\n\r\n      t.timestamps null: false\r\n    end\r\n  end\r\nend\r\n\r\n$ rake db:migrate\r\n...\r\nActiveRecord::StatementInvalid: Mysql2::Error: Can't create table 'planner_dev.#sql-52f_b' (errno: 150): ALTER TABLE `bar` ADD CONSTRAINT `fk_rails_e70b15738f`\r\nFOREIGN KEY (`foo_id`)\r\n  REFERENCES `foos` (`id`)\r\n```"}}