Heroku上的act-as-taggable-on

时间:2010-10-11 12:49:03

标签: ruby-on-rails ruby postgresql rubygems heroku

我一直在我的开发应用中使用acts-as-taggable-on进行标记,但是当我将它推送到Heroku时,我收到了一个令人讨厌的错误:

ActionView::TemplateError (PGError: ERROR:  relation "tags" does not exist
: SELECT tags.*, taggings.tags_count AS count FROM "tags"  JOIN (SELECT taggings.tag_id, COUNT(taggings.tag_id) AS tags_count FROM "taggings"  INNER JOIN offers ON offers.id = taggings.taggable_id WHERE (taggings.taggable_type = E'Offer' AND taggings.context = E'tags')  GROUP BY taggings.tag_id HAVING COUNT(*) > 0 AND COUNT(taggings.tag_id) > 0) AS taggings ON taggings.tag_id = tags.id ) on line #29 of app/views/offers/index.html.erb:
26: <div id="sidebar">
27:     <!-- <h3>Popular Tags</h3>
28:
29:     <% tag_cloud(@tags, %w(css1 css2 css3 css4)) do |tag, css_class| %>
30:         <% link_to tag.name, { :action => :tag, :id => tag.name }, :class => css_class %>
31:     <% end %> -->
32:

    app/views/offers/index.html.erb:29
    app/controllers/offers_controller.rb:11:in `index'
    /home/heroku_rack/lib/static_assets.rb:9:in `call'
    /home/heroku_rack/lib/last_access.rb:15:in `call'
    /home/heroku_rack/lib/date_header.rb:14:in `call'
    thin (1.2.6) lib/thin/connection.rb:76:in `pre_process'
    thin (1.2.6) lib/thin/connection.rb:74:in `catch'
    thin (1.2.6) lib/thin/connection.rb:74:in `pre_process'
    thin (1.2.6) lib/thin/connection.rb:57:in `process'
    thin (1.2.6) lib/thin/connection.rb:42:in `receive_data'
    eventmachine (0.12.10) lib/eventmachine.rb:256:in `run_machine'
    eventmachine (0.12.10) lib/eventmachine.rb:256:in `run'
    thin (1.2.6) lib/thin/backends/base.rb:57:in `start'
    thin (1.2.6) lib/thin/server.rb:156:in `start'
    thin (1.2.6) lib/thin/controllers/controller.rb:80:in `start'
    thin (1.2.6) lib/thin/runner.rb:177:in `send'
    thin (1.2.6) lib/thin/runner.rb:177:in `run_command'
    thin (1.2.6) lib/thin/runner.rb:143:in `run!'
    thin (1.2.6) bin/thin:6
    /usr/ruby1.8.7/bin/thin:19:in `load'
    /usr/ruby1.8.7/bin/thin:19

有谁知道如何让插件在Heroku的PostgreSQL上运行?

谢谢!

2 个答案:

答案 0 :(得分:1)

以下内容将您的dev DB镜像到heroku上的生产:     heroku rake db:push

但您可能真正需要(ed)做的是运行迁移     heroku rake db:migrate

祝你好运!

答案 1 :(得分:0)

我不知道为什么,但是db:migrate对我来说不起作用,而是我做db:schema:加载,现在工作顺利。试一试。