Created
August 3, 2009 14:54
-
-
Save hukl/160599 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From c10e9ebe037cd6671cfe250dff9c8289d524bc3a Mon Sep 17 00:00:00 2001 | |
From: hukl <[email protected]> | |
Date: Mon, 3 Aug 2009 16:54:06 +0200 | |
Subject: [PATCH] helper method to create translation table no considers table_prefixes | |
--- | |
lib/globalize/model/active_record/translated.rb | 6 +++--- | |
1 files changed, 3 insertions(+), 3 deletions(-) | |
diff --git a/lib/globalize/model/active_record/translated.rb b/lib/globalize/model/active_record/translated.rb | |
index dc37e2e..d498c16 100644 | |
--- a/lib/globalize/model/active_record/translated.rb | |
+++ b/lib/globalize/model/active_record/translated.rb | |
@@ -90,9 +90,9 @@ module Globalize | |
raise BadMigrationFieldType, "Bad field type for #{name}, should be :string or :text" | |
end | |
end | |
- translation_table_name = self.name.underscore + '_translations' | |
+ translation_table_name = self.table_name.singularize + '_translations' | |
self.connection.create_table(translation_table_name) do |t| | |
- t.references self.table_name.singularize | |
+ t.references self.name.underscore | |
t.string :locale | |
fields.each do |name, type| | |
t.column name, type | |
@@ -101,7 +101,7 @@ module Globalize | |
end | |
self.connection.add_index( | |
- translation_table_name, "#{self.table_name.singularize}_id" | |
+ translation_table_name, "#{self.name.underscore}_id" | |
) | |
end | |
-- | |
1.6.3.3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment