Tag: heroku

当ID存在时,获取“表的未知主键”

我一直在调试这个Rails的奇怪问题,给我“桌子的未知主键……”,即使桌子的ID在那里。 我已经将数据库从一个heroku应用程序复制到另一个,在原始数据库上没有问题,新的一个给了我一个db错误。 这是错误: ProductsController# (ActionView::Template::Error) “Unknown primary key for table collections in model Collection.” /app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/reflection.rb:366:in `primary_key’ /app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/reflection.rb:480:in `association_primary_key’ /app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/associations/association_scope.rb:58:in `block in add_constraints’ /app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/associations/association_scope.rb:39:in `each’ /app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/associations/association_scope.rb:39:in `each_with_index’ /app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/associations/association_scope.rb:39:in `add_constraints’ /app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/associations/association_scope.rb:31:in `scope’ /app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/associations/association.rb:98:in `association_scope’ /app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/associations/association.rb:87:in `scoped’ /app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/associations/collection_association.rb:573:in `first_or_last’ /app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/associations/collection_association.rb:105:in `last’ /app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/associations/collection_proxy.rb:46:in `last’ /app/app/helpers/likes_helper.rb:62:in `significant_liker’ 导致它的线: product.collections.last.try :user 和表: d8apjspa441pad=> \d collections Table “public.collections” Column | Type | […]

初始推送大型回购的替代方法

我在开发和生产中有一个较大的Rails 3.1应用程序,我只是在Heroku上设置了一个临时环境。 因为我的git repo非常庞大,所以每次尝试推送时都会出现33%的超时错误。 对于这个最初的巨型推动,有没有替代做git push staging master ? 错误消息是 EmBP-2:Appname Emma$ git push staging master Counting objects: 17421, done. Delta compression using up to 4 threads. Compressing objects: 100% (6363/6363), done. Connection to 10.10.18.33 closed by remote host.46 KiB/s error: pack-objects died of signal 13 error: failed to push some refs to ‘git@heroku.com:appname-staging.git’ ///////////////////解决方案/编辑,几个月后…… […]

在Heroku中创建临时文件

我有一个托管@ ​​Heroku的应用程序。 该应用程序依赖于使用套接字侦听器获取的某些提要。 套接字侦听器每秒获取一行XML。 一旦我检测到来自侦听器的文件信号结束,我就将文件上传到Amazon S3服务器。 但是,直到收到文件信号结束,是否可以将文件内容保存为Heroku中的临时文件?

Heroku with rails 5错误Gem :: LoadError:为数据库适配器指定’postgresql’

我是Rails的初学者,在部署到Heroku时我看到了一些问题。 之前我使用的是SQLite3,后来当我明白我需要postgresql时,我安装了相同的并在本地机器上工作。 从sqlite迁移到postgresql后,一次部署正常。 现在我看到一些问题。 Heroku日志,Gem文件和Database.yml详细信息如下。 请有人帮助我。 提前谢谢…… !!! Gem文件的一部分: group :development, :test do gem ‘pg’, ‘~> 1.0.0’ gem ‘rails_12factor’ #gem ‘sqlite3’ # Call ‘byebug’ anywhere in the code to stop execution and get a debugger console gem ‘byebug’, platforms: [:mri, :mingw, :x64_mingw] # Adds support for Capybara system testing and selenium driver gem ‘capybara’, ‘~> […]

heroku mongohq和mongoid Mongo :: ConnectionFailure

2012年6月9日更新: 在heroku上使用mongoid 3.0.0.rc进行设置,请参阅此要点: https ://gist.github.com/2900804 2011年1月22日更新: Uri现在优先于mongoid.yml https://github.com/mongoid/mongoid/issues/issue/266 更新2010年8月12日:虽然我得到了Jackues Crocker的第6个可接受的答案,但是这个问题的某些方面很容易搞砸! 它再次发生在我身上,我决定研究mongoid源代码。 所以,在这里: 目前, 主机:端口:名称/数据库:设置在uri:设置上取得了优先权 。 因此,由于对localhost:xxxx的请求而不是对flame.local.mongohq.com:xxxx的请求,发生了非常无法提供信息的错误消息 这会打破! defaults: &defaults host: localhost <- THIS 'OVERWRITES' host in the uri! production: <<: *defaults <- BE CAREFUL WITH WHAT YOU BRING IN. THE host: FROM DEFAULTS WILL BE THE ONE APPLIED, not your uri host. uri: 修复它,删除主机:默认情况下,和/或删除<<:*默认值 原文问: […]

内存在一个空的Rails应用程序中无限增长

我无法弄清楚为什么我的Rails应用程序(在Heroku(雪松)上托管)不断分配越来越多的内存。 如果我不知道更好,我会说这是Ruby / Rails中的内存泄漏,但由于我是Ruby / Rails的新手,我觉得我错过了一些完全明显的东西。 我正在使用rails new生成的Rails默认值,以及完全最新的gem: source ‘https://rubygems.org’ gem ‘rails’, ‘3.2.8’ group :development do gem ‘sqlite3’ end group :assets do gem “sass-rails”, “~> 3.2.5” gem “coffee-rails”, “~> 3.2.2” gem “uglifier”, “~> 1.3.0” end gem “jquery-rails”, “~> 2.1.2” group :production do gem ‘newrelic_rpm’ gem “pg”, “~> 0.14.1” end 我正在使用默认的newrelic配置 。 我有零模型和一个控制器, nothing_controller.rb ,它是使用rails generate […]

蓝图css rails 3.1帮助

我的蓝图css在我的本地机器上工作,但是当我推送到heroku时我得到一个错误。 我的蓝图存储在我的app/assets/stylesheets folder ,这里是我正在使用的样式表标签: ‘screen’ %> ‘print’ %> 在我的heroku日志中,它说application.css没有预编译,我认为这可能是错误,但我不知道如何解决它。 这是我的heroku日志: 2011-09-04T07:35:59+00:00 heroku[web.1]: Idling 2011-09-04T07:36:00+00:00 heroku[web.1]: State changed from up to down 2011-09-04T07:36:00+00:00 heroku[web.1]: State changed from down to created 2011-09-04T07:36:00+00:00 heroku[web.1]: State changed from created to starting 2011-09-04T07:36:01+00:00 heroku[web.1]: Stopping process with SIGTERM 2011-09-04T07:36:01+00:00 app[web.1]: >> Stopping … 2011-09-04T07:36:01+00:00 heroku[web.1]: Process exited 2011-09-04T07:36:04+00:00 heroku[web.1]: Starting […]

推送到Heroku时Rails迁移错误w / Postgres

我正在尝试执行以下向上迁移以更改“tweet”模型表中的“number”列 class ChangeDataTypeForTweetsNumber < ActiveRecord::Migration def up change_column :tweets do |t| t.change :number, :integer end end def down change_table :tweets do |t| t.change :number, :string end end end 执行以下向上迁移到heroku …. heroku rake db:migrate:up VERSION=20120925211232 我收到以下错误 PG::Error: ERROR: column “number” cannot be cast to type integer : ALTER TABLE “tweets” ALTER COLUMN “number” TYPE integer 任何想法都会非常感激。 […]

Rails,Heroku和Subdomains。 我的特殊情况是否可行?

这是我的情景: 我有一个必须支持多个客户端的应用程序。 每个客户端都将获得一个服务的子域。 我们还将有一个没有该应用程序的手册网站,它只是一个关于该产品的网站以及潜在客户如何与我们建立帐户。 鉴于: www.mycoolsite.com将指向Heroku上的宣传册应用程序。 client1.mycoolsite.com , client2.mycoolsite.com和client3.mycoolsite.com都会指向同一个SaaS应用程序,它可以告诉我们每个请求之间的区别,我应该能够处理,所以他们只看到他们的日期(即设置一个全局client_id或类似的东西) 我该怎么做呢? 我没有用DNS做过很多,所以我对从哪里开始这个很无能为力。 谢谢。

Heroku帮助部署使用Mysql数据库的Rails应用程序

我正在尝试部署使用Mysql的Rails应用程序 我有: 创建了一个Heroku应用程序并将我的应用程序推送到heroku。 我添加了Amazon RDS我创建了一个Amazon RDS数据库实例。 我的Heroku Amazon RDS数据库URL是:mysql:// mysusername:mypassword@rdshostname.amazonaws.com/mydatabasename 我的Amazon RDS数据库安全组设置为默认值 我试图推送我的本地数据库,但得到以下错误Heroku帮助Amazon RDS rails推送数据库错误 我究竟做错了什么 ? 什么是我的Rdshostname? 它是亚马逊端点吗?