Number is out of range for ActiveModel::Type::Integer with limit 4
<p>I created my migration with limit 8 in the chat_id column:</p>

<pre><code>class CreateChat &lt; ActiveRecord::Migration[5.0]
  def change
    create_table :bots do |t|
      t.integer :user_chat_id, null: false, limit: 8, unique: true
      ...
      t.timestamps
    end
  end
end
</code></pre>

<p>The migration is created perfectly and I can insert data into it.
But if I do:</p>

<pre><code>class Chat &lt; ApplicationRecord
  self.primary_key = 'user_chat_id'
end
</code></pre>

<p>The following error occurs, 5187762395178250 is out of range for ActiveModel :: Type :: Integer with limit 4.</p>

<p>I researched and looked in the documentation, but I did not find anything about it.</p>