Why is the rails_12factor gem necessary on Heroku?

后端 未结 6 395
情歌与酒
情歌与酒 2021-01-01 17:13

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_12facto

相关标签:
6条回答
  • 2021-01-01 17:49

    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.

    0 讨论(0)
  • 2021-01-01 18:02

    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.

    0 讨论(0)
  • 2021-01-01 18:06

    As of Rails 5, you no longer need to include this gem in your Gemfile. They've removed it from their documentation also: https://github.com/railsbridge/docs/issues/569

    0 讨论(0)
  • 2021-01-01 18:07

    Just ran into a problem with a Rails 4 application on Heroku and couldn't debug it with heroku run logs. Without the rails12factor gem, you can't see the full logs that you normally see on your console in development. I was getting a 500 error and there wasn't any available information.

    It actually didn't tell me that migrations were pending without rails12factor

    0 讨论(0)
  • 2021-01-01 18:08

    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.

    0 讨论(0)
  • 2021-01-01 18:11

    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.

    0 讨论(0)
提交回复
热议问题