Draco
Draco

Reputation: 262

Saving editable data in Rails 3 on Heroku

My rails app allows users to edit a certain json file through the browser. This data file is saved in app/assets/data/thefile.json (the site is only used internally)

I tested the front-end locally and it worked fine, the data gets updated and saved. Then I pushed the code to Heroku and tested it there as well. It worked. However after about 1 day when I go back to the site, I realized that the data has reverted to its original state before it was edited.

This happened numerous times and I'm not so sure why it happened. Maybe because Heroku does not allow files in the app folder to be edited?

Any advice would be greatly appreciated!

Upvotes: 1

Views: 86

Answers (1)

Dty
Dty

Reputation: 12273

Probably has something to do with the fact that Heroku has a read only file system.

There's also a note here on the ephemeral file system

Each dyno gets its own ephemeral filesystem, with a fresh copy of the most recently deployed code. During the dyno’s lifetime its running processes can use the filesystem as a temporary scratchpad, but no files that are written are visible to processes in any other dyno and any files written will be discarded the moment the dyno is stopped or restarted.

Upvotes: 2

Related Questions