Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is the rails_12factor gem necessary on Heroku?

Tags:

heroku

I noticed that the new version of Michael Hartl's Ruby on Rails Tutorial says to include the following to serving static assets on Heroku

gem 'rails_12factor', group: :production

The previous version of his book did not have that. Can someone explain the details of what happened with Heroku that requires this gem?

like image 230
user782220 Avatar asked Nov 01 '13 08:11

user782220


4 Answers

The best answer I could find is by looking at the rails_12factor README.

There's also a discussion on why Heroku decided to include the gem: Why does this gem exist? Especially read the answer from schneems about halfway down the page.

like image 126
Daniel Avatar answered Nov 07 '22 09:11

Daniel


This gem enables serving assets in production and setting your logger to standard out, both of which are required to run a Rails 4 application on a twelve-factor provider. The gem also makes the appropriate changes for Rails 3 apps.

like image 33
Shoaib Malik Avatar answered Nov 07 '22 09:11

Shoaib Malik


In the Getting Started with Rails 4.x on Heroku, we can read this:

Heroku integration has previously relied on using the Rails plugin system, which has been removed from Rails 4. To enable features such as static asset serving and logging on Heroku please add rails_12factor gem to your Gemfile.

like image 37
DLight Avatar answered Nov 07 '22 11:11

DLight


Older question, but FWIW Rails 5 Apps do not require the rails_12factor gem. Per the README:

We worked with the Rails core team to make Rails 5 work on twelve-factor platforms out of the box.

There is also a snippet for migrating to Rails 5.

like image 22
jdgray Avatar answered Nov 07 '22 09:11

jdgray