Permalink
Browse files

apparently the foreign key should not be prefixed with table_name_pre…

…fix - please test this and report if there are any issues.
  • Loading branch information...
1 parent f778dd5 commit f532c9b51a79d14b18305ef306e3d37e78fef3f3 @hukl hukl committed Apr 22, 2010
Showing with 6 additions and 2 deletions.
  1. +6 −2 lib/globalize/active_record/migration.rb
@@ -13,15 +13,19 @@ def create_translation_table!(fields)
end
self.connection.create_table(translation_table_name) do |t|
- t.references self.table_name.singularize
+ t.references table_name.sub(/^#{table_name_prefix}/, "").singularize
t.string :locale
fields.each do |name, type|
t.column name, type
end
t.timestamps
end
- self.connection.add_index(translation_table_name, "#{self.table_name.singularize}_id", :name => translation_index_name)
+ self.connection.add_index(
+ translation_table_name,
+ "#{table_name.sub(/^#{table_name_prefix}/, "").singularize}_id",
+ :name => translation_index_name
+ )
end
def translation_index_name

0 comments on commit f532c9b

Please sign in to comment.