3

我正在嘗試使用Globalize3作爲向名爲EventCategory的模型提供翻譯的簡單方法。Globalize3 - 嘗試將翻譯添加到現有模型時的遷移錯誤

不幸的是,當我跑步時,通過耙分貝遷移:遷移,我有以下錯誤:

== AddTranslationsToEventCategory: migrating ================================= 
rake aborted! 
An error has occurred, this and all later migrations canceled: 

PG::Error: 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 

Tasks: TOP => db:migrate 
(See full trace by running task with --trace) 

我已經開始使用Google的解決方案,並發現這一點:Relation "translations" does not exist after migrating to Rails 3.2.1

但這對我來說不起作用。

這裏是我的移民:

class AddTranslationsToEventCategory < ActiveRecord::Migration 
    def self.up 
    EventCategory.create_translation_table!({ 
     :name => :string 
    }, { 
     :migrate_data => true 
    }) 
    end 

    def self.down 
    EventCategory.drop_translation_table! :migrate_data => true 
    end 
end 

沒有真正棘手爲止!我不明白爲什麼它不起作用。

我在運行Mountain Lion的MacBookPro上使用Rails 3.2.8。 Postgres是數據庫系統。我已將我的應用程序提交給GitHub。請在這裏找到它:https://github.com/lionelrudaz/myteam2

讓我知道你是否需要更多信息。

在此先感謝!

乾杯,

梅西

回答

2

在GitHub上提交了這個問題後,我終於得到了幫助,從Philip Arndt和問題已被固定在Globalize3的0.3.0版本。因此,簡單的辦法就是卸載Gemfile中,並與編輯:

gem 'globalize3', '>= 0.3.0' 

希望這有助於。

相關問題