undefined method `set_table_name' while migrating (Rails 4) #261

mcmegavolt opened this Issue Aug 13, 2013 · 8 comments


None yet
3 participants

when I run migration I get error:

undefined method `set_table_name' for Article::Category::Translation(Table doesn't exist): Class /home/user/.rvm/gems/ruby-2.0.0-p195/gems/activerecord-4.0.0/lib/active_record/dynamic_matchers.rb:22:in `method_missing'

My code:


class Article::Category < ActiveRecord::Base
    translates :name, :description

migration file

class TranslateCategories < ActiveRecord::Migration
  def self.up
      :name => :string,
      :description => :text
    }, {
      :migrate_data => true

  def self.down
    Article::Category.drop_translation_table! :migrate_data => true

parndt commented Aug 13, 2013

Which version of Globalize are you using? Are you using the rails4 branch? In Gemfile:

gem 'globalize3', github: 'svenfuchs/globalize3', branch: 'rails4'

no, I just use

gem 'globalize3'

sory, I have not found gem installing instructions for Rails 4 before :)

When I use your solution, I get error while bundle update

Could not find gem 'paper_trail (~> 3.0.0.beta) ruby', which is required by gem 'globalize3 (>= 0) ruby', in any of the sources.

shioyama commented Aug 14, 2013

You have to also use the latest version of paper_trail by explicitly putting it in your gemfile, like this:

gem 'paper_trail', github: 'airblade/paper_trail', branch: 'master'

See the rails4 branch readme.

Thnks, it worked!
One more question, do I need :name and :description fields in original article_categories table?


shioyama commented Oct 25, 2013

If you have migrated your data to the translations table, you should no longer need the name and description columns in the original table.

Also FYI, the rails4 branch is now master, and we've created a new globalize gem with major version numbers locked to AR numbers, so you can just use:

gem 'globalize', '~> 4.0.0.alpha.2'

Can I close this?

Yeah, thank you!


shioyama commented Oct 25, 2013

Great, thanks!

shioyama closed this Oct 25, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment