globalize-automatic 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/globalize/automatic/translation.rb +4 -1
- data/lib/globalize/automatic/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb2bdc07b52a065892fbf2fe1a62944680b84877
|
4
|
+
data.tar.gz: e55cdbdc3711ab995ceff3342fad836d3641cc7d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a399b52c75a2faa0d4c3a29d3419273d8eba650763441833cf16014859607110a580f99e6dade457d5c7daf49a05869fb96e5613d7df5187faa080b32abadf7
|
7
|
+
data.tar.gz: 540c9061ddba4f91e0280c2acd64eaab33a00c94f1e389d4ff31c7fa3fc4c358680dbc2e1a0c43d1ab52aefc082d0d2df2e70b1dfd6833c6eb64d74fec615b81
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'digest/md5'
|
2
|
+
|
1
3
|
class Globalize::Automatic::Translation < ActiveRecord::Base
|
2
4
|
self.abstract_class = true
|
3
5
|
|
@@ -43,8 +45,9 @@ class Globalize::Automatic::Translation < ActiveRecord::Base
|
|
43
45
|
|
44
46
|
class << self
|
45
47
|
def create_table!(*fields)
|
48
|
+
relation_name = automatic_translated_model_foreign_key.sub(/_id$/, '')
|
46
49
|
connection.create_table(table_name) do |t|
|
47
|
-
t.references
|
50
|
+
t.references relation_name, null: false, index: { name: "index_#{Digest::MD5.hexdigest([table_name, relation_name].join('/'))}" }
|
48
51
|
t.string :locale, null: false
|
49
52
|
fields.each do |field|
|
50
53
|
t.boolean *automatically_column_args(field)
|