How to use Sprockets Rails plugin on Heroku?

I just deployed the Rails application in Heroku, but the Javascripts that used the Sprockets plugin do not work.

I realized that since my Heroku app is read-only, Sprockets will not work. I found this sprockets_on_heroku plugin that should do the job, but I really don't understand how to use it:

  • I added config.gem sprockets to config / environment.rb
  • I added sprockets to the .gems file
  • I clicked them on Heroku and Sprockets was successfully installed.
  • I ran the script/plugin install git://github.com/jeffrydegrande/sprockets_on_heroku.git and the plugin was successfully installed

Nothing changed on Heroku, so I tried installing the plugin on Heroku using heroku plugins:install git://github.com/jeffrydegrande/sprockets_on_heroku.git , which returned sprockets_on_heroku installed , but then the heroku restart or heroku plugins will return this:

~ / .heroku / plugins / sprockets_on_heroku / init.rb: 1: uninitialized constant ActionController (NameError)

from / opt / local / lib / ruby ​​/ gems / 1.8 / gems / heroku-1.8.3 / bin /../ lib / heroku / plugin.rb: 25: in `load '

from / opt / local / lib / ruby ​​/ gems / 1.8 / gems / heroku-1.8.3 / bin /../ lib / heroku / plugin.rb: 25: in `load! ''

from / opt / local / lib / ruby ​​/ gems / 1.8 / gems / heroku-1.8.3 / bin /../ lib / heroku / plugin.rb: 22: in `each '

from / opt / local / lib / ruby ​​/ gems / 1.8 / gems / heroku-1.8.3 / bin /../ lib / heroku / plugin.rb: 22: in `load! ''

from / opt / local / lib / ruby ​​/ gems / 1.8 / gems / heroku-1.8.3 / bin /../ lib / heroku / command.rb: 14: in `run '

from / opt / local / lib / ruby ​​/ gems / 1.8 / gems / heroku-1.8.3 / bin / heroku: 14

from / opt / local / bin / heroku: 19: in `load '

from / opt / local / bin / heroku: 19

What should I do?

Kevin

+1
source share
1 answer

Stars on Geroku author Jeffrey Degrand answered my e-mail. The only thing I had to do was git push heroku after installing the plugin so that the files were deployed to Heroku. In short:

  • Add config.gem sprockets to config / environment.rb
  • Add sprockets to .gems file
  • Run script/plugin install git://github.com/jeffrydegrande/sprockets_on_heroku.git
  • Click on changes in Heroku
+1
source

Source: https://habr.com/ru/post/901058/


All Articles