batch_translations 0.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/batch_translations.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "batch_translations"
|
3
|
-
s.version = "0.1"
|
3
|
+
s.version = "0.1.2"
|
4
4
|
s.date = "2011-11-06"
|
5
5
|
s.summary = "allow saving multiple globalize2 translations in the same request"
|
6
6
|
s.email = "sebcioz@gmail.com"
|
@@ -9,6 +9,6 @@ Gem::Specification.new do |s|
|
|
9
9
|
s.require_path = "lib"
|
10
10
|
s.has_rdoc = false
|
11
11
|
s.authors = ['Szymon Fiedler']
|
12
|
-
s.files = ["batch_translations.gemspec", 'lib/
|
12
|
+
s.files = ["batch_translations.gemspec", 'lib/batch_translations.rb'] +
|
13
13
|
Dir.glob("lib/**/*")
|
14
14
|
end
|
@@ -19,6 +19,25 @@ module ActionView
|
|
19
19
|
end
|
20
20
|
|
21
21
|
module Globalize
|
22
|
+
module ActiveRecord
|
23
|
+
module InstanceMethods
|
24
|
+
def update_attributes_with_translations(options)
|
25
|
+
options.each do |key, value|
|
26
|
+
if key == "translations_attributes"
|
27
|
+
translated_attrs = {}
|
28
|
+
value.each do |rec_id, rec_value|
|
29
|
+
rec_value.delete("id")
|
30
|
+
translated_attrs[rec_value.delete("locale")] = rec_value
|
31
|
+
end
|
32
|
+
self.set_translations(translated_attrs)
|
33
|
+
else
|
34
|
+
self.update_attribute(key, value)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
22
41
|
module Model
|
23
42
|
module ActiveRecord
|
24
43
|
module Translated
|
@@ -46,4 +65,4 @@ module Globalize
|
|
46
65
|
end
|
47
66
|
end
|
48
67
|
end
|
49
|
-
end
|
68
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: batch_translations
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 0.1.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -21,7 +21,7 @@ extensions: []
|
|
21
21
|
extra_rdoc_files: []
|
22
22
|
files:
|
23
23
|
- batch_translations.gemspec
|
24
|
-
- lib/
|
24
|
+
- lib/batch_translations.rb
|
25
25
|
has_rdoc: false
|
26
26
|
homepage: https://github.com/sebcioz/batch_translations
|
27
27
|
licenses: []
|