Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/heroku/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 生产环境中的Rails供应商插件故障_Ruby On Rails_Heroku_Ruby On Rails Plugins - Fatal编程技术网

Ruby on rails 生产环境中的Rails供应商插件故障

Ruby on rails 生产环境中的Rails供应商插件故障,ruby-on-rails,heroku,ruby-on-rails-plugins,Ruby On Rails,Heroku,Ruby On Rails Plugins,我认为这是一个n00b问题 我正在尝试在rails应用程序中使用heroku。在开发过程中(本地机器)一切正常,但当我推到heroku时,我得到以下信息: ==> dyno-1931938.log (crash) <== /home/slugs/258915_4fd8878_0dbe-1413ed77-735c-469d-924e-619b28cdcbac/mnt/.bundle/gems/ruby/1.8/gems/activerecord-3.0.0/lib/active_rec

我认为这是一个n00b问题

我正在尝试在rails应用程序中使用heroku。在开发过程中(本地机器)一切正常,但当我推到heroku时,我得到以下信息:

==> dyno-1931938.log (crash) <==
/home/slugs/258915_4fd8878_0dbe-1413ed77-735c-469d-924e-619b28cdcbac/mnt/.bundle/gems/ruby/1.8/gems/activerecord-3.0.0/lib/active_record/base.rb:1016:in `method_missing': undefined local variable or method `acts_as_paranoid' for #<Class:0x2b469869b658> (NameError)
    from /disk1/home/slugs/258915_4fd8878_0dbe-1413ed77-735c-469d-924e-619b28cdcbac/mnt/app/models/my_model.rb:17
“acts_as_paranoid”是一个供应商插件,通过以下方式在本地安装:

$git clone https://github.com/goncalossilva/rails3_acts_as_paranoid.git
我做错了什么,heroku忽略了插件


更新:
我从heroku克隆了repo,插件的目录存在,但为空。我的其他插件(即ssl_需求)具有expect lib/和init.rb。显然,代码需要在那里工作。现在怎么办?

克隆源代码会从github检索代码,但它不会将gem安装到你的应用程序中。通常,您会在本地计算机上安装gem,如下所示:

gem install acts_as_paranoid

然后通过将以下内容添加到.gems文件中,向Heroku介绍gem:

acts_as_paranoid
或者更好的是,也可以指定您期望的版本(否则,每次向应用程序推送新代码时,Heroku都会获取最新版本,这可能会导致意外的破坏):

并确保您的config/environment.rb中有一个gem条目,以便在启动时检测到它的缺失,而不是稍后:

config.gem 'acts_as_paranoid', :version => 'x.y.z'

PS:如果您使用Rails 3和/或Bundler来管理您的gems,以上所有内容都会有所不同。

结果是
供应商/plugins/my_plugin_目录
已经从git树中掉出来了。我通过以下方式解决了问题:

$cd rails_root_directory
$git fsck
$git rm --cached vendor/plugins/my_plugin_directory
$git add vendor/plugins/my_plugin_directory/*
$git commit -am "my_plugin added to repository"
$git push heroku master

现在一切都好了。

这是一个插件,而不是一个gem,难道没有不同的过程吗?另外,我已经修改了插件,所以我想使用我的本地副本,而不是存储库中的副本。是的,我使用的是rails 3/bundler。是的,如果它是一个真正的插件,它应该可以从您的供应商/插件目录中找到。在这种情况下,它既是一个gem,也是一个插件,所以您可以使用任何一种方法。对,在您的情况下(修改代码),插件更有意义。很高兴你找到了解决办法。我将在这里留下我的答案,以防它能帮助有gem选项的人。嗯-你有没有设法让acts_as_偏执狂参与Rails 3项目?在我的电脑上,它再也找不到它所依赖的许多活动记录方法了……我使用rails3作为偏执狂:
acts_as_paranoid --version x.y.z
config.gem 'acts_as_paranoid', :version => 'x.y.z'
$cd rails_root_directory
$git fsck
$git rm --cached vendor/plugins/my_plugin_directory
$git add vendor/plugins/my_plugin_directory/*
$git commit -am "my_plugin added to repository"
$git push heroku master