RailsCasts Pro episodes are now free!

Learn more or hide this

Luiz Gustavo Freire Gama's Profile

GitHub User: luizgamabh

Site: http://onrails.com.br

Comments by Luiz Gustavo Freire Gama


When I call recreate_versions! method a new file is generated and older files are kept on uploads directory. What's the best way to remove older files after recreating versions?


Sorry. I found the problem, I just don't need to submit the form, because jquery file uploader does it automatically after selecting photos. Then, when I submit, no photos are being sent through the form, then create method is trying to save null.


I followed this video tutorial and every time I'm uploading photos, an additional line with NULL value to all columns is being created. So if I upload 3 photos are created four lines at database table, three OK and one null. Has anyone experienced the same problem or any idea where I could have been wrong? If I create a migration preventing null values ​​in the column photo, an error occurs after upload:

Mysql2::Error: Column 'photo' cannot be null: INSERT INTO photos (created_at, project_id, photo, updated_at) VALUES ('2013-04-28 04:54:34', 19, NULL, '2013-04-28 04:54:34')