我是 Rails 新手,我在 Lynda.com 上完成了 Kevin Skoglund 的 Ruby on Rails 3 Essential Training 课程。通过课程,您设置了一个简单的 cms,我做到了。它不包括 Git 或部署,但我已将我的简单 cms 推送到 github ( https://github.com/nick5a1/Simple_CMS ) 并部署到 Heroku ( http://nkarrasch.herokuapp.com/ )。
为了部署到 Heroku,我按照 Heroku 设置指南 ( https://devcenter.heroku.com/articles/rails3 ) 将我的数据库从 MySQL 切换到 PostgreSQL。按照指示,我在 Gemfile 中将 gen'mysql2' 更改为 gen'sqlite3' 并在推送之前运行 bundle install 。然后我跑了heroku run rake db:migrate
。
我遇到了2个问题。当我尝试登录 ( http://nkarrasch.herokuapp.com/access ) 时,我收到一条错误消息“我们很抱歉,但出了点问题”。相反,我应该收到一条包含无效用户名/密码组合的 Flash 消息。这就是我在本地机器上的测试环境中得到的。
其次,当我登录 Heroku 控制台以创建和创建管理员用户时,当我尝试保存该用户时,我收到以下错误:
irb(main):004:0> user.save
(1.2ms) BEGIN
AdminUser Exists (1.9ms) SELECT 1 AS one FROM "admin_users" WHERE "admin_users"."username" = 'Nick5a1' LIMIT 1
(1.7ms) ROLLBACK
=> false
任何有关如何排除故障的建议将不胜感激:)。
非常感谢,尼克
编辑:这是我的 Heroku 日志:
2012-06-27T20:36:44+00:00 heroku[slugc]: Slug compilation started
2012-06-27T20:37:34+00:00 heroku[api]: Add shared-database:5mb add-on by *
2012-06-27T20:37:34+00:00 heroku[api]: Release v2 created by *
2012-06-27T20:37:34+00:00 heroku[api]: Add RAILS_ENV, LANG, PATH, RACK_ENV, GEM_PATH config by *
2012-06-27T20:37:34+00:00 heroku[api]: Release v3 created by *
2012-06-27T20:37:34+00:00 heroku[api]: Release v4 created by *
2012-06-27T20:37:34+00:00 heroku[api]: Deploy 1d82839 by *
2012-06-27T20:37:35+00:00 heroku[slugc]: Slug compilation finished
2012-06-27T20:37:36+00:00 heroku[web.1]: Starting process with command `bundle exec rails server -p 45450`
2012-06-27T20:37:40+00:00 app[web.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/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/config/environment.rb:5)
2012-06-27T20:37:40+00:00 app[web.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/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/config/environment.rb:5)
2012-06-27T20:37:40+00:00 app[web.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/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/config/environment.rb:5)
2012-06-27T20:37:44+00:00 app[web.1]: => Rails 3.2.6 application starting in production on http://0.0.0.0:45450
2012-06-27T20:37:44+00:00 app[web.1]: => Call with -d to detach
2012-06-27T20:37:44+00:00 app[web.1]: => Booting WEBrick
2012-06-27T20:37:44+00:00 app[web.1]: Connecting to database specified by DATABASE_URL
2012-06-27T20:37:44+00:00 app[web.1]: => Ctrl-C to shutdown server
2012-06-27T20:37:44+00:00 app[web.1]: [2012-06-27 20:37:44] INFO WEBrick 1.3.1
2012-06-27T20:37:44+00:00 app[web.1]: [2012-06-27 20:37:44] INFO ruby 1.9.2 (2011-07-09) [x86_64-linux]
2012-06-27T20:37:44+00:00 app[web.1]: [2012-06-27 20:37:44] INFO WEBrick::HTTPServer#start: pid=2 port=45450
2012-06-27T20:37:45+00:00 heroku[web.1]: State changed from starting to up
2012-06-27T20:39:44+00:00 heroku[run.1]: Awaiting client
2012-06-27T20:39:44+00:00 heroku[run.1]: Starting process with command `bundle exec rake db:migrate`
2012-06-27T20:39:44+00:00 heroku[run.1]: State changed from starting to up
2012-06-27T20:39:51+00:00 heroku[run.1]: Process exited with status 0
2012-06-27T20:39:51+00:00 heroku[run.1]: State changed from up to complete
2012-06-27T20:41:05+00:00 heroku[run.1]: Awaiting client
2012-06-27T20:41:05+00:00 heroku[run.1]: Starting process with command `bundle exec rails console`
2012-06-27T20:41:05+00:00 heroku[run.1]: State changed from starting to up
2012-06-27T20:46:09+00:00 heroku[run.1]: Process exited with status 0
2012-06-27T20:46:09+00:00 heroku[run.1]: State changed from up to complete