开发者

How to use Sprockets Rails plugin on Heroku?

I just deployed my Rails app to Heroku, but the Javascripts that were using Sprockets plugin don't work.

I understood that, because my Heroku app is read-only, Sprockets won't work. I've found this sprockets_on_heroku plugin that should do the work, but I don't really get how to use it :

  1. I added config.gem sprockets in config/environment.rb
  2. I added sprockets in my .gems file
  3. I pushed these on Heroku and Sprockets was successfully installed
  4. I locally ran script/plugin install git://github.com/jeffrydegrande/sprockets_on_heroku.git and the plugin was successfully installed

Nothing changed on Heroku, so I tried to install the plugin on Heroku with heroku plugins:install git://github.com/jeffrydegrande/sprockets_on_heroku.git, which returned sprockets_on_heroku installedbut the开发者_如何学运维n, a heroku restartor a heroku pluginscommand would 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


Sprockets on Heroku's author Jeffry Degrande answered my e-mail. The only thing I should have done is to git push heroku after installing the plugin so that the files are deployed to Heroku. In short:

  1. Add config.gem sprockets in config/environment.rb
  2. Add sprockets in .gems file
  3. Run script/plugin install git://github.com/jeffrydegrande/sprockets_on_heroku.git
  4. Push the changes to Heroku
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜