Ruby on rails “希罗库”;我们';“很抱歉,出了点问题。”;

Ruby on rails “希罗库”;我们';“很抱歉,出了点问题。”;,ruby-on-rails,ruby,heroku,Ruby On Rails,Ruby,Heroku,首先,我是rails/heroku的新手,所以请提前原谅我的新手 我做了Rails教程(http://guides.rubyonrails.org/getting_started.html)并生成了一个类似博客的“post”应用程序,将其推送到github,然后推送到heroku 我的应用程序在本地运行良好,但当我尝试在线运行时,它会出现红色字体错误“我们很抱歉,但出了问题” 以下是heroku日志: 2012-06-17T18:20:21+00:00 app[web.1]: Started G

首先,我是rails/heroku的新手,所以请提前原谅我的新手

我做了Rails教程(http://guides.rubyonrails.org/getting_started.html)并生成了一个类似博客的“post”应用程序,将其推送到github,然后推送到heroku

我的应用程序在本地运行良好,但当我尝试在线运行时,它会出现红色字体错误“我们很抱歉,但出了问题”

以下是heroku日志:

2012-06-17T18:20:21+00:00 app[web.1]: Started GET "/posts/new" for 24.246.75.91 at 2012-06-17 18:20:21 +0000
2012-06-17T18:20:21+00:00 app[web.1]: Processing by PostsController#new as HTML
2012-06-17T18:20:21+00:00 app[web.1]:   Rendered posts/_form.html.erb (19.4ms)
2012-06-17T18:20:21+00:00 app[web.1]:   Rendered posts/new.html.erb within layouts/application (32.8ms)
2012-06-17T18:20:21+00:00 app[web.1]: Completed 500 Internal Server Error in 39ms
2012-06-17T18:20:21+00:00 app[web.1]: 
2012-06-17T18:20:21+00:00 app[web.1]:     13: 
2012-06-17T18:20:21+00:00 app[web.1]: ActionView::Template::Error (undefined method `name' for #<Post:0x000000043b8e00>):
2012-06-17T18:20:21+00:00 app[web.1]:     14:   <div class="field">
2012-06-17T18:20:21+00:00 app[web.1]:     15:     <%= f.label :name %><br />
2012-06-17T18:20:21+00:00 app[web.1]:     18:   <div class="field">
2012-06-17T18:20:21+00:00 app[web.1]:     17:   </div>
2012-06-17T18:20:21+00:00 app[web.1]:     16:     <%= f.text_field :name %>
2012-06-17T18:20:21+00:00 app[web.1]:     19:     <%= f.label :title %><br />
2012-06-17T18:20:21+00:00 app[web.1]:   app/views/posts/_form.html.erb:16:in `block in _app_views_posts__form_html_erb___4393344465537738631_33651200'
2012-06-17T18:20:21+00:00 app[web.1]:   app/views/posts/_form.html.erb:1:in `_app_views_posts__form_html_erb___4393344465537738631_33651200'
2012-06-17T18:20:21+00:00 app[web.1]:   app/views/posts/new.html.erb:3:in `_app_views_posts_new_html_erb___263954971377171473_37473500'
2012-06-17T18:20:21+00:00 app[web.1]:   app/controllers/posts_controller.rb:35:in `new'
2012-06-17T18:20:21+00:00 app[web.1]: 
2012-06-17T18:20:21+00:00应用程序[web.1]:在2012-06-17 18:20:21+0000开始为24.246.75.91获取“/posts/new”
2012-06-17T18:20:21+00:00应用程序[web.1]:PostsController处理#新为HTML
2012-06-17T18:20:21+00:00应用程序[web.1]:呈现帖子/_form.html.erb(19.4ms)
2012-06-17T18:20:21+00:00应用程序[web.1]:在版面/应用程序中呈现帖子/new.html.erb(32.8ms)
2012-06-17T18:20:21+00:00应用程序[web.1]:在39毫秒内完成500个内部服务器错误
2012-06-17T18:20:21+00:00应用程序[web.1]:
2012-06-17T18:20:21+00:00应用程序[网站1]:13:
2012-06-17T18:20:21+00:00应用程序[web.1]:ActionView::Template::Error(未定义#的“name”方法):
2012-06-17T18:20:21+00:00应用程序[网站1]:14:
2012-06-17T18:20:21+00:00应用程序[网站1]:15:
2012-06-17T18:20:21+00:00应用程序[网站1]:18: 2012-06-17T18:20:21+00:00应用程序[网站1]:17: 2012-06-17T18:20:21+00:00应用程序[网站1]:16: 2012-06-17T18:20:21+00:00应用程序[网站1]:19:
2012-06-17T18:20:21+00:00 app[web.1]:app/views/posts/_form.html.erb:16:in'block in_app_view_posts_form_html_erb_4393344465537738631_33651200' 2012-06-17T18:20:21+00:00应用程序[web.1]:app/views/posts/_-form.html.erb:1:in``应用程序视图_-posts _-form_-html_-erb uuuuuuuuu 439344465537738631 _33651200' 2012-06-17T18:20:21+00:00应用程序[web.1]:app/views/posts/new.html.erb:3:in``应用程序视图发布新的html\u erb\u2639549713771473\u37473500' 2012-06-17T18:20:21+00:00应用程序[web.1]:app/controllers/posts_controller.rb:35:in'new' 2012-06-17T18:20:21+00:00应用程序[web.1]:
简言之,f.name是一个对象,表示数据库中的一个条目(f的大部分信息也是如此)

“undefined method`name'”错误对我来说似乎很奇怪,因为它可以在本地完美地工作

我的假设是,heroku和我的应用程序之间的数据库链接不正确。 然而,我不知道如何解决/检查这个问题

我的应用现在默认使用“共享数据库”

关于什么支票有什么提示吗?我错过了什么

编辑1: 正在迁移数据库。表“posts”似乎已被“检测到”。以下是一个跟踪:

   Running rake db:migrate --trace attached to terminal... up, run.1
DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/01/04/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/Rakefile:7)
DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/01/04/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/Rakefile:7)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:load_config (first_time)
** Invoke rails_env (first_time)
** Execute rails_env
** Execute db:load_config
** Execute db:migrate
Migrating to CreatePosts (20120418005214)
==  CreatePosts: migrating ====================================================
-- create_table(:posts)
rake aborted!
An error has occurred, this and all later migrations canceled:

PG::Error: ERROR:  relation "posts" already exists
: CREATE TABLE "posts" ("id" serial primary key, "name" character varying(255), "title" character varying(255), "content" text, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) 
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.1/lib/active_record/connection_adapters/postgresql_adapter.rb:640:in `async_exec'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.1/lib/active_record/connection_adapters/postgresql_adapter.rb:640:in `block in execute'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.1/lib/active_record/connection_adapters/abstract_adapter.rb:280:in `block in log'
/app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.1/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.1/lib/active_record/connection_adapters/abstract_adapter.rb:275:in `log'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.1/lib/active_record/connection_adapters/postgresql_adapter.rb:639:in `execute'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.1/lib/active_record/connection_adapters/abstract/schema_statements.rb:170:in `create_table'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.1/lib/active_record/migration.rb:450:in `block in method_missing'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.1/lib/active_record/migration.rb:424:in `block in say_with_time'
/app/vendor/ruby-1.9.3-p0/lib/ruby/1.9.1/benchmark.rb:280:in `measure'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.1/lib/active_record/migration.rb:424:in `say_with_time'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.1/lib/active_record/migration.rb:444:in `method_missing'
/app/db/migrate/20120418005214_create_posts.rb:3:in `change'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.1/lib/active_record/migration.rb:393:in `block (2 levels) in migrate'
/app/vendor/ruby-1.9.3-p0/lib/ruby/1.9.1/benchmark.rb:280:in `measure'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.1/lib/active_record/migration.rb:393:in `block in migrate'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:118:in `with_connection'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.1/lib/active_record/migration.rb:377:in `migrate'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.1/lib/active_record/migration.rb:512:in `migrate'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.1/lib/active_record/migration.rb:704:in `block (2 levels) in migrate'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.1/lib/active_record/migration.rb:759:in `call'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.1/lib/active_record/migration.rb:759:in `block in ddl_transaction'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:190:in `transaction'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.1/lib/active_record/transactions.rb:208:in `transaction'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.1/lib/active_record/migration.rb:759:in `ddl_transaction'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.1/lib/active_record/migration.rb:703:in `block in migrate'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.1/lib/active_record/migration.rb:684:in `each'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.1/lib/active_record/migration.rb:684:in `migrate'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.1/lib/active_record/migration.rb:554:in `up'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.1/lib/active_record/migration.rb:535:in `migrate'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.1/lib/active_record/railties/databases.rake:153:in `block (2 levels) in <top (required)>'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in execute'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/app/vendor/ruby-1.9.3-p0/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block (2 levels) in top_level'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block in top_level'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `block in run'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
/app/vendor/bundle/ruby/1.9.1/bin/rake:19:in `load'
/app/vendor/bundle/ruby/1.9.1/bin/rake:19:in `<main>'
Tasks: TOP => db:migrate
运行rake db:migrate--跟踪附加到终端。。。起来,跑
弃用警告:在供应商/插件中有Rails 2.3风格的插件!对这些插件的支持将在Rails 4.0中删除。将它们移出并打包到您的Gemfile中,或者将它们作为lib/myplugin/*和config/initializers/myplugin.rb折叠到您的应用程序中。有关这方面的更多信息,请参阅发行说明:http://weblog.rubyonrails.org/2012/01/04/rails-3-2-0-rc2-has-been-released. (从at/app/Rakefile:7调用)
弃用警告:在供应商/插件中有Rails 2.3风格的插件!对这些插件的支持将在Rails 4.0中删除。将它们移出并打包到您的Gemfile中,或者将它们作为lib/myplugin/*和config/initializers/myplugin.rb折叠到您的应用程序中。有关这方面的更多信息,请参阅发行说明:http://weblog.rubyonrails.org/2012/01/04/rails-3-2-0-rc2-has-been-released. (从at/app/Rakefile:7调用)
**调用数据库:迁移(第一次)
**调用环境(第一次)
**执行环境
**调用数据库:加载配置(第一次)
**调用rails_env(第一次)
**执行rails_env
**执行db:load\u config
**执行数据库:迁移
迁移到CreatePosts(20120418005214)
==CreatePosts:正在迁移====================================================
--创建_表(:posts)
雷克流产了!
发生错误,此迁移和所有后续迁移已取消:
PG::错误:错误:关系“posts”已存在
:创建表“posts”(“id”序列主键,“name”字符变化(255),“title”字符变化(255),“content”文本,“timestamp NOT NULL”处创建,“timestamp NOT NULL”处更新)
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.1/lib/active\u record/connection\u adapters/postgresql\u adapter.rb:640:in'async\u exec'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.1/lib/active\u record/connection\u adapters/postgresql\u adapter.rb:640:in'block in execute'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.1/lib/active\u record/connection\u adapters/abstract\u adapter.rb:280:in`block in log'
/app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.1/lib/active\u support/notifications/instrumenter.rb:20:in'instrument'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.1/lib/active\u record/connection\u adapters/abstract\u adapter.rb:275:in`log'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.1/lib/active\u record/connection\u adapters/postgresql\u adapter.rb:639:in'execute'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.1/lib/active\u record/connection\u adapters/abstract/schema\u statements.rb:170:in'create\u table'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.1/lib/active\u record/migration.rb:450:“方法中的块缺失”
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.1/lib/active\u record/migration.rb:424:in`block in say_with_time'
/app/vendor/ruby-1.9.3-p0/lib/ruby/1.9.1/benchmark.rb:280:in'measure'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.1/lib/active\u record/migration.rb:424:in'say\u with\u time'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.1/lib/active\u record/migration.rb:444:in'method\u missing'
/app/db/migrate/20120418005214创建帖子。rb:3:in“change”
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.1/lib/active_-record/migration.rb:393:in`block(2层)in migrate'
/app/vendor/ruby-1.9.3-p0/lib/ruby/1.9.1/benchmark.rb:280:in'measure'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.1/lib/active\u record/migration.rb:393:in`block
19:06:34[~/ED3/ed3/]>heroku run rake db:drop
Running rake db:drop attached to terminal... up, run.1
DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/01/04/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/Rakefile:7)
DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/01/04/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/Rakefile:7)
Couldn't drop mtstktqkyx : #<ActiveRecord::StatementInvalid: PG::Error: ERROR:  must be owner of database mtstktqkyx
: DROP DATABASE IF EXISTS "mtstktqkyx">
class CreatePosts < ActiveRecord::Migration
  def change
    create_table :posts do |t|
      t.string :name
      t.string :title
      t.text :content

      t.timestamps
    end
  end
end
heroku run rake db:migrate