Rails 4.2 finally added native support for database-level foreign keys, which is great. You can write the following code in a migration (assuming the presence of a users table): def change create_table :posts do |t| t.references :user, index: true end add_foreign_key :posts, :users end And Rails will apply its conventions and infer what you expect: Column | Type | Modifiers ---------+---------+---