Heroku Error R14 (Memory quota exceeded): How do I solve this?

Look for code with 'Model.all.each do |something|' and replace with Model.find_each do |something|. This will save memory by loading chunks of your model into memory instead of the entire model all at once.

Also, look for opportunities to use in_groups_of or :limit to decrease the number of objects that are saved in memory at one time.

EDIT: for_each -> find_each.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)