سؤال

I'm trying to use Globalize3 as a simple way to provide translations to a model called EventCategory.

Unfortunately, when I'm running the migration through rake db:migrate, I have the following error:

==  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)

I've started googling for a solution, and found this: Relation "translations" does not exist after migrating to Rails 3.2.1

But it doesn't work in my case.

Here's my migration:

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

Nothing really tricky so far! I don't see why it's not working.

I'm using Rails 3.2.8 on a MacBookPro running Mountain Lion. Postgres is the database system. I've committed my app to GitHub. Please find it here: https://github.com/lionelrudaz/myteam2

Let me know if you need more information.

Thanks in advance!

Cheers,

Lionel

هل كانت مفيدة؟

المحلول

After submitting this question on GitHub, I finally got help from Philip Arndt and issue has been fixed in version 0.3.0 of Globalize3. So the solution is simply to uninstall the gemfile and edit it with:

gem 'globalize3', '>= 0.3.0'

Hope this helps.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top