globalize3 0.2.0.beta6 → 0.2.0.beta7
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +39 -41
- data/README.textile +7 -5
- data/lib/globalize/active_record/act_macro.rb +2 -0
- data/lib/globalize/active_record/migration.rb +4 -4
- data/lib/globalize3/version.rb +1 -1
- metadata +4 -4
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
globalize3 (0.2.0.
|
4
|
+
globalize3 (0.2.0.beta6)
|
5
5
|
activemodel (>= 3.0.0)
|
6
6
|
activerecord (>= 3.0.0)
|
7
7
|
paper_trail (~> 2)
|
@@ -9,74 +9,72 @@ PATH
|
|
9
9
|
GEM
|
10
10
|
remote: http://rubygems.org/
|
11
11
|
specs:
|
12
|
-
actionmailer (3.1
|
13
|
-
actionpack (= 3.1
|
14
|
-
mail (~> 2.
|
15
|
-
actionpack (3.1
|
16
|
-
activemodel (= 3.1
|
17
|
-
activesupport (= 3.1
|
12
|
+
actionmailer (3.2.1)
|
13
|
+
actionpack (= 3.2.1)
|
14
|
+
mail (~> 2.4.0)
|
15
|
+
actionpack (3.2.1)
|
16
|
+
activemodel (= 3.2.1)
|
17
|
+
activesupport (= 3.2.1)
|
18
18
|
builder (~> 3.0.0)
|
19
19
|
erubis (~> 2.7.0)
|
20
|
-
|
21
|
-
rack (~> 1.
|
20
|
+
journey (~> 1.0.1)
|
21
|
+
rack (~> 1.4.0)
|
22
22
|
rack-cache (~> 1.1)
|
23
|
-
rack-mount (~> 0.8.2)
|
24
23
|
rack-test (~> 0.6.1)
|
25
|
-
sprockets (~> 2.
|
26
|
-
activemodel (3.1
|
27
|
-
activesupport (= 3.1
|
24
|
+
sprockets (~> 2.1.2)
|
25
|
+
activemodel (3.2.1)
|
26
|
+
activesupport (= 3.2.1)
|
28
27
|
builder (~> 3.0.0)
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
arel (~> 2.2.1)
|
28
|
+
activerecord (3.2.1)
|
29
|
+
activemodel (= 3.2.1)
|
30
|
+
activesupport (= 3.2.1)
|
31
|
+
arel (~> 3.0.0)
|
34
32
|
tzinfo (~> 0.3.29)
|
35
|
-
activeresource (3.1
|
36
|
-
activemodel (= 3.1
|
37
|
-
activesupport (= 3.1
|
38
|
-
activesupport (3.1
|
33
|
+
activeresource (3.2.1)
|
34
|
+
activemodel (= 3.2.1)
|
35
|
+
activesupport (= 3.2.1)
|
36
|
+
activesupport (3.2.1)
|
37
|
+
i18n (~> 0.6)
|
39
38
|
multi_json (~> 1.0)
|
40
|
-
arel (
|
39
|
+
arel (3.0.0)
|
41
40
|
builder (3.0.0)
|
42
41
|
database_cleaner (0.5.2)
|
43
42
|
erubis (2.7.0)
|
44
43
|
hike (1.2.1)
|
45
44
|
i18n (0.6.0)
|
46
|
-
|
47
|
-
|
45
|
+
journey (1.0.1)
|
46
|
+
json (1.6.5)
|
47
|
+
mail (2.4.1)
|
48
48
|
i18n (>= 0.4.0)
|
49
49
|
mime-types (~> 1.16)
|
50
50
|
treetop (~> 1.4.8)
|
51
51
|
metaclass (0.0.1)
|
52
52
|
mime-types (1.17.2)
|
53
|
-
mocha (0.10.
|
53
|
+
mocha (0.10.3)
|
54
54
|
metaclass (~> 0.0.1)
|
55
55
|
multi_json (1.0.4)
|
56
|
-
paper_trail (2.
|
56
|
+
paper_trail (2.6.0)
|
57
57
|
rails (~> 3)
|
58
58
|
pathname_local (0.0.2)
|
59
59
|
polyglot (0.3.3)
|
60
|
-
rack (1.
|
60
|
+
rack (1.4.1)
|
61
61
|
rack-cache (1.1)
|
62
62
|
rack (>= 0.4)
|
63
|
-
rack-mount (0.8.3)
|
64
|
-
rack (>= 1.0.0)
|
65
63
|
rack-ssl (1.3.2)
|
66
64
|
rack
|
67
65
|
rack-test (0.6.1)
|
68
66
|
rack (>= 1.0)
|
69
|
-
rails (3.1
|
70
|
-
actionmailer (= 3.1
|
71
|
-
actionpack (= 3.1
|
72
|
-
activerecord (= 3.1
|
73
|
-
activeresource (= 3.1
|
74
|
-
activesupport (= 3.1
|
67
|
+
rails (3.2.1)
|
68
|
+
actionmailer (= 3.2.1)
|
69
|
+
actionpack (= 3.2.1)
|
70
|
+
activerecord (= 3.2.1)
|
71
|
+
activeresource (= 3.2.1)
|
72
|
+
activesupport (= 3.2.1)
|
75
73
|
bundler (~> 1.0)
|
76
|
-
railties (= 3.1
|
77
|
-
railties (3.1
|
78
|
-
actionpack (= 3.1
|
79
|
-
activesupport (= 3.1
|
74
|
+
railties (= 3.2.1)
|
75
|
+
railties (3.2.1)
|
76
|
+
actionpack (= 3.2.1)
|
77
|
+
activesupport (= 3.2.1)
|
80
78
|
rack-ssl (~> 1.3.2)
|
81
79
|
rake (>= 0.8.7)
|
82
80
|
rdoc (~> 3.4)
|
@@ -84,7 +82,7 @@ GEM
|
|
84
82
|
rake (0.9.2.2)
|
85
83
|
rdoc (3.12)
|
86
84
|
json (~> 1.4)
|
87
|
-
sprockets (2.
|
85
|
+
sprockets (2.1.2)
|
88
86
|
hike (~> 1.2)
|
89
87
|
rack (~> 1.0)
|
90
88
|
tilt (~> 1.1, != 1.3.0)
|
data/README.textile
CHANGED
@@ -106,15 +106,17 @@ the translation was applied. Here's an example (which assumes you already have a
|
|
106
106
|
|
107
107
|
h2. Versioning with Globalize3
|
108
108
|
|
109
|
-
Globalize3 nicely integrates with
|
109
|
+
Globalize3 nicely integrates with
|
110
|
+
"paper_trail":https://github.com/airblade/paper_trail. To add versioning
|
111
|
+
support to your model, you'll want to add the <code>:versioning => true</code>
|
112
|
+
option to your call to <code>translates</code>. An example from our test suite:
|
110
113
|
|
111
114
|
<pre><code>
|
112
|
-
|
115
|
+
translates :title, :content, :published, :published_at, :versioning => true
|
113
116
|
</code></pre>
|
114
117
|
|
115
|
-
|
116
|
-
|
117
|
-
Please also note that @update_attribute@ currently hides itself from dirty tracking in ActiveRecord >= 3.0.0.beta (which is considered a "regression":http://github.com/rails/rails/commit/01629d180468049d17a8be6900e27a4f0d2b18c4#commitcomment-123199). That means that you currently need to use attribute writers or @update_attributes@ in order to track changes/versions for your models.
|
118
|
+
You will also need to have already generated the versions table that paper_trail
|
119
|
+
expects. See the paper_trail README for more details.
|
118
120
|
|
119
121
|
Also, please see the tests in test/globalize3/versioning_test.rb for some current gotchas.
|
120
122
|
|
@@ -15,6 +15,8 @@ module Globalize
|
|
15
15
|
include InstanceMethods
|
16
16
|
extend ClassMethods, Migration
|
17
17
|
|
18
|
+
translation_class.table_name = options[:table_name] if translation_class.table_name.blank?
|
19
|
+
|
18
20
|
has_many :translations, :class_name => translation_class.name,
|
19
21
|
:foreign_key => class_name.foreign_key,
|
20
22
|
:dependent => :destroy,
|
@@ -79,11 +79,11 @@ module Globalize
|
|
79
79
|
end
|
80
80
|
|
81
81
|
def drop_translations_index
|
82
|
-
connection.remove_index(translations_table_name, :name => translation_index_name)
|
82
|
+
connection.remove_index(translations_table_name, :name => translation_index_name)
|
83
83
|
end
|
84
84
|
|
85
85
|
def move_data_to_translation_table
|
86
|
-
# this refactored version might be a good idea,
|
86
|
+
# this refactored version might be a good idea,
|
87
87
|
# but only if made into a code that doesn't break tests
|
88
88
|
# model.find_each do |record|
|
89
89
|
# translation = record.translations.build(:locale => I18n.default_locale)
|
@@ -92,10 +92,10 @@ module Globalize
|
|
92
92
|
# end
|
93
93
|
# translation.save!
|
94
94
|
# end
|
95
|
-
|
95
|
+
|
96
96
|
# Find all of the existing untranslated attributes for this model.
|
97
97
|
all_model_fields = @model.all
|
98
|
-
model_attributes = all_model_fields.
|
98
|
+
model_attributes = all_model_fields.map(&:untranslated_attributes)
|
99
99
|
all_model_fields.each do |model_record|
|
100
100
|
# Assign the attributes back to the model which will enable globalize3 to translate them.
|
101
101
|
model_record.attributes = model_attributes.detect{|a| a['id'] == model_record.id}
|
data/lib/globalize3/version.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: globalize3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 2257864407
|
5
5
|
prerelease: 6
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
9
|
- 0
|
10
10
|
- beta
|
11
|
-
-
|
12
|
-
version: 0.2.0.
|
11
|
+
- 7
|
12
|
+
version: 0.2.0.beta7
|
13
13
|
platform: ruby
|
14
14
|
authors:
|
15
15
|
- Sven Fuchs
|
@@ -22,7 +22,7 @@ autorequire:
|
|
22
22
|
bindir: bin
|
23
23
|
cert_chain: []
|
24
24
|
|
25
|
-
date: 2012-01
|
25
|
+
date: 2012-02-01 00:00:00 Z
|
26
26
|
dependencies:
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: activerecord
|