I'm working on a Rails 4.2.5 app that allows to upload videos using Paperclip. It works fine except for very large files. Using a video that is over 3GB I get the following error:
RangeError (3283091012 is out of range for ActiveRecord::Type::Integer with limit 4)
Now I can tell that 3283091012
is the size of the file so I ithought this happens when MySQL is trying to save that value for the file_size
field created by paperclip and I could fix it by increasing the limit in the database or even better using a migration file, but I thought I'd check the table structure before and I was surprised with the following:
mysql> describe formats;
+-------------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------------------+--------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| video_id | int(11) | YES | MUL | NULL | |
| name | varchar(255) | YES | | NULL | |
| quality | varchar(255) | YES | | NULL | |
| created_at | datetime | NO | | NULL | |
| updated_at | datetime | NO | | NULL | |
| file_file_name | varchar(255) | YES | | NULL | |
| file_content_type | varchar(255) | YES | | NULL | |
| file_file_size | int(11) | YES | | NULL | |
| file_updated_at | datetime | YES | | NULL | |
| trailer | tinyint(1) | YES | | 0 | |
+-------------------+--------------+------+-----+---------+----------------+
As you can see file_file_size
is an int(11)
not 4 as claimed by the error.
Any idea what is causing this?
Note: I do not have any fancy validations on the model (just forcing the presence of a couple of attributes) and the controller action is a regular create action.