在Heroku上部署Rails教程第11章的问题

时间:2010-11-25 04:16:26

标签: ruby-on-rails heroku

我正在关注Rails教程并刚刚完成第11章。在localhost上没有错误,但在heroku上没有错误。 heroku日志(如下所示)说“关系'微博'不存在”后跟一些sql。鉴于localhost运行良好,我不知道该怎么办。有什么想法吗?

[sample_app (master)]$ heroku logs
==> production.log <==


Started GET "/" for 96.225.159.51 at Wed Nov 24 19:05:00 -0800 2010
  Processing by PagesController#home as HTML
Completed   in 18ms

ActiveRecord::StatementInvalid (PGError: ERROR:  relation "microposts" does not exist
:             SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a.attnotnull
              FROM pg_attribute a LEFT JOIN pg_attrdef d
                ON a.attrelid = d.adrelid AND a.attnum = d.adnum
             WHERE a.attrelid = '"microposts"'::regclass
               AND a.attnum > 0 AND NOT a.attisdropped
             ORDER BY a.attnum
):
  app/controllers/pages_controller.rb:6:in `new'
  app/controllers/pages_controller.rb:6:in `home'


==> dyno-2890282.log <==
DEPRECATION WARNING: railtie_name is deprecated and has no effect. (called from require at /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.3/lib/bundler/runtime.rb:64)
>> Thin web server (v1.2.6 codename Crazy Delicious)
>> Maximum connections set to 1024
>> Listening on 0.0.0.0:51899, CTRL+C to stop

这是pages_controller.rb:

class PagesController < ApplicationController

  def home
    @title = "Home"
    if signed_in?
      @micropost = Micropost.new 
      @feed_items = current_user.feed.paginate(:page => params[:page])
    end
  end

  def contact
    @title = "Contact"
  end

  def about
    @title = "About"
  end

  def help
    @title = "Help"
  end
end

1 个答案:

答案 0 :(得分:1)

好的......最愚蠢的问题。我正在玩新手卡....忘记了“heroku rake db:migrate”。一切都很好。