Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/22.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 本地postrges可行,但可以';t似乎没有推动RAILS\u ENV=production heroku_Ruby On Rails_Ruby_Postgresql_Heroku - Fatal编程技术网

Ruby on rails 本地postrges可行,但可以';t似乎没有推动RAILS\u ENV=production heroku

Ruby on rails 本地postrges可行,但可以';t似乎没有推动RAILS\u ENV=production heroku,ruby-on-rails,ruby,postgresql,heroku,Ruby On Rails,Ruby,Postgresql,Heroku,我的应用程序在localhost:3000的本地环境中运行良好。它正在从我的本地postgres db中提取数据,但是我似乎没有更新生产环境。我的欢迎页面可以在我的页面上查看,但是当我单击nav链接查看另一个页面时,我得到了一个错误,我假设是因为该页面调用了数据库中的数据,而它找不到这些数据 我正在做$railsdb:migraterails\u ENV=production 我在终端中获得以下输出: (0.2ms) SELECT pg_try_advisory_lock(3666737882

我的应用程序在localhost:3000的本地环境中运行良好。它正在从我的本地postgres db中提取数据,但是我似乎没有更新生产环境。我的欢迎页面可以在我的页面上查看,但是当我单击nav链接查看另一个页面时,我得到了一个错误,我假设是因为该页面调用了数据库中的数据,而它找不到这些数据

我正在做
$railsdb:migraterails\u ENV=production

我在终端中获得以下输出:

(0.2ms)  SELECT pg_try_advisory_lock(3666737882978712990);
ActiveRecord::SchemaMigration Load (0.6ms)  SELECT "schema_migrations".* 
FROM "schema_migrations"
ActiveRecord::InternalMetadata Load (0.6ms)  SELECT  
"ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2  [["key", :environment], ["LIMIT", 1]]
(0.2ms)  BEGIN
SQL (1.9ms)  UPDATE "ar_internal_metadata" SET "value" = $1, "updated_at" = $2 WHERE "ar_internal_metadata"."key" = $3  [["value", "production"], ["updated_at", 2017-03-31 10:42:57 UTC], ["key", "environment"]]
(0.4ms)  COMMIT
(0.2ms)  SELECT pg_advisory_unlock(3666737882978712990)
我的gem文件中有gem'pg'

My database.yml看起来像:

default: &default
 adapter: postgresql
 pool: 5
 timeout: 5000

development:
 adapter: postgresql
 database: postgresql-rectangular-42683
 pool: 5
 timeout: 5000
test:
 adapter: postgresql
 database: postgresql-rectangular-42683
 pool: 5
 timeout: 5000

production:
 adapter: postgresql
 database: postgresql-rectangular-42683
 username: Simon
 password: *************

 pool: 5
 timeout: 5000`
有什么想法吗?已经尝试了一天左右的各种事情:(


Simon

在终端中尝试以下操作:

heroku run rake db:create:all
然后运行迁移:

heroku run rake db:migrate

另外,您可以发布heroku日志的输出吗?请在终端中尝试以下操作:

heroku run rake db:create:all
然后运行迁移:

heroku run rake db:migrate

另外,你能发布heroku日志的输出吗?哈哈,两分钟后我发现了问题所在,和往常一样,问题很简单。我需要运行
$heroku run rake db:seed

虽然这似乎只是添加了表,但我的行仍然显示为0/10000


另外,我的页面仍然没有加载,但不能100%确定这与数据库有关。

哈哈,两分钟后我发现了问题所在,像往常一样,问题很简单。我需要运行
$heroku run rake db:seed

虽然这似乎只是添加了表,但我的行仍然显示为0/10000

此外,我的页面仍然没有加载,但不能100%确定这与数据库有关