如何在Heroku上使用Sprockets Rails插件? [英] How to use Sprockets Rails plugin on Heroku?

查看:147
本文介绍了如何在Heroku上使用Sprockets Rails插件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我明白这一点,因为我的Heroku应用程序已被读取,所以我的Heroku应用程序被读取只有链轮不能使用。我发现这个应该做这项工作的 sprockets_on_heroku 插件,但我真的不知道如何使用它:


  1. 我在config / environment.rb中添加了 config.gem sprockets

  2. 我在.gems文件中添加了 sprockets
  3. 我在Heroku和Sprockets已成功安装

  4. 本地运行 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的链轮回答了我的电子邮件。我应该做的唯一事情是在安装插件之后 ,以便将文件部署到Heroku。简而言之:在config / environment.rb中添加 config.gem链轮


  1. / li>
  2. 在.gems文件中添加 sprockets
  3. 运行 script / plugin安装git://github.com/jeffrydegrande/sprockets_on_heroku.git

  4. 将更改推送至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 then, 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

这篇关于如何在Heroku上使用Sprockets Rails插件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆