如何在Heroku上使用Sprockets Rails插件? [英] How to use Sprockets Rails plugin on Heroku?
问题描述
我明白这一点,因为我的Heroku应用程序已被读取,所以我的Heroku应用程序被读取只有链轮不能使用。我发现这个应该做这项工作的 sprockets_on_heroku 插件,但我真的不知道如何使用它:
- 我在config / environment.rb中添加了
config.gem sprockets
- 我在.gems文件中添加了
sprockets
- 我在Heroku和Sprockets已成功安装
- 本地运行
script / plugin install git://github.com/jeffrydegrande/sprockets_on_heroku.git
和插件已成功安装
Heroku没有任何变化,所以我尝试在Heroku上安装插件,使用 heroku插件:安装git://github.com/jeffrydegrande/sprockets_on_heroku.git
,它返回了 sprockets_on_heroku安装了
,但是,然后,一个 heroku重新启动
或者 heroku插件
命令将会返回:
〜/。他来自/opt/local/lib/ruby/gems/1.8/gems/heroku的roku / plugins / sprockets_on_heroku / init.rb:1:未初始化的常量ActionController(NameError)
-1.8.3 / bin /../ lib / heroku / plugin.rb:25:在`load'中从/ 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:在`each'中
<来自/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'
从/opt/local/lib/ruby/gems/1.8/gems/heroku-1.8.3/bin/heroku:14
从/ opt / local / bin / heroku开始:
从/ opt / local / bin / heroku开始:19:在load中
/ p>
我该怎么办?
凯文
Heroku的作者Jeffry Degrande的链轮回答了我的电子邮件。我应该做的唯一事情是在安装插件之后 config.gem链轮
- / li>
- 在.gems文件中添加
sprockets
- 运行
script / plugin安装git://github.com/jeffrydegrande/sprockets_on_heroku.git
- 将更改推送至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 :
- I added
config.gem sprockets
in config/environment.rb - I added
sprockets
in my .gems file - I pushed these on Heroku and Sprockets was successfully installed
- 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 installed
but then, a heroku restart
or a heroku plugins
command 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:
- Add
config.gem sprockets
in config/environment.rb - Add
sprockets
in .gems file - Run
script/plugin install git://github.com/jeffrydegrande/sprockets_on_heroku.git
- Push the changes to Heroku
这篇关于如何在Heroku上使用Sprockets Rails插件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!