0

I am using rails-3.2.2, i18n-0.6.0 and globalize3-0.2.0 ruby-gems. I installed and correctly run Globalized for a my class named Article. However, when I run the rake db:seed task in the Terminal window I get the following error:

$ rake db:seed
rake aborted!
Mysql2::Error: Unknown database 'article_translations': SHOW TABLES IN article_translations LIKE 'title'

In my <ROOT_APP>/config/seed.rb file I have:

Article.find_or_create_by_title(
  :title => 'Title example',
  ...
)

In my <ROOT_APP>/app/models/article.rb file I have:

class Article < ActiveRecord::Base
  translates :title, :fallbacks_for_empty_translations => true

  ...
end

How can I solve the error?

More details at https://github.com/svenfuchs/globalize3/pull/123.


Note: I think the problem is related to the find_or_create_by_title method called in the <ROOT_APP>/config/seed.rb (in fact, if I use the find method instead of find_or_create_by_title I do not get the rake error explained above). If it is true, what I can do to keep my seed.rb file clear since I will need some hack (for example, like that shown below) to solve the problem?

# The below code has the same effect as the 'find_or_create_by_title' method.
Article.create(:title, 'Title example updated!') unless Article.exists?(:title => 'Title example')
user502052
  • 14,803
  • 30
  • 109
  • 188

1 Answers1

1

Chances are you failed to run rake db:create / rake db:migrate first

Ben Miller
  • 1,464
  • 12
  • 13