raycchan
raycchan

Reputation: 313

File path in rake task on heroku

I have a rake task in Rails which job is basically to just open a file and write some text, I have

  def self.log
    File.open("#{Rails.root.join("app/views/main/log.html.erb")}", "a+"){|f| f << "sometext" }
  end

My file is at /app/views/main/log.html.erb

This works perfectly fine locally, but once I upload onto Heroku it doesn't write anything to the file (no error message either). Suspecting the file path is incorrect, or anything else I don't know about Heroku? Thanks!

Upvotes: 1

Views: 906

Answers (1)

Benjamin Tan Wei Hao
Benjamin Tan Wei Hao

Reputation: 9691

Heroku's filesystem is read only. It is highlighted in this article: https://devcenter.heroku.com/articles/read-only-filesystem. Hope that helps.

Upvotes: 1

Related Questions