Relation “translations” does not exist after migrating to Rails 3.2.1

断了今生、忘了曾经 提交于 2020-01-06 02:28:12

问题


I migrated from Rails 3.1.3 to 3.2.1 and got the following error when loading the home page:

PGError: ERROR:  relation "translations" does not exist
LINE 4:              WHERE a.attrelid = '"translations"'::regclass
                                    ^
:             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 = '"translations"'::regclass
           AND a.attnum > 0 AND NOT a.attisdropped
         ORDER BY a.attnum

This happens when globalize3 gem tries to build the relation between page_meta_tags and page_meta_tag_translations tables. Everything worked fine on Rails 3.1.3. Can it be due to new Active Record and globalize3 incompatibility? Anyone has the same thing?

class PageMetaTag < ActiveRecord::Base
  translates :title, :description, :keywords

  accepts_nested_attributes_for :translations
end

回答1:


try using globalize3 beta:

gem 'globalize3', '0.2.0.beta8'


来源:https://stackoverflow.com/questions/9173499/relation-translations-does-not-exist-after-migrating-to-rails-3-2-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!