monglobal 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/monglobal/version.rb +1 -1
- data/lib/monglobal.rb +7 -11
- data/monglobal.gemspec +2 -0
- metadata +14 -4
data/lib/monglobal/version.rb
CHANGED
data/lib/monglobal.rb
CHANGED
@@ -1,10 +1,6 @@
|
|
1
1
|
require "monglobal/version"
|
2
2
|
require 'active_support'
|
3
3
|
|
4
|
-
LANGS = []
|
5
|
-
for lang in I18n.available_locales
|
6
|
-
LANGS << lang.to_sym
|
7
|
-
end
|
8
4
|
|
9
5
|
module Monglobal
|
10
6
|
|
@@ -25,19 +21,18 @@ module Monglobal
|
|
25
21
|
translations = send("#{self.class.to_s}Translation".underscore.pluralize.to_sym)
|
26
22
|
translation_class = Kernel.const_get("#{self.class.to_s}Translation")
|
27
23
|
|
24
|
+
|
28
25
|
# update existing translations
|
29
26
|
translations.each do |translation|
|
30
27
|
translation.update_attributes(params.delete(translation.locale))
|
31
28
|
end
|
32
29
|
|
33
30
|
# create new translations
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
translations << tr
|
40
|
-
end
|
31
|
+
attrs = params[locale]
|
32
|
+
if attrs
|
33
|
+
tr = translation_class.new(attrs)
|
34
|
+
tr.locale = locale
|
35
|
+
translations << tr
|
41
36
|
end
|
42
37
|
|
43
38
|
save
|
@@ -56,6 +51,7 @@ module Monglobal
|
|
56
51
|
args.each do |attr|
|
57
52
|
key attr.to_sym, String
|
58
53
|
end
|
54
|
+
|
59
55
|
end
|
60
56
|
Object.const_set klass_name, translation_model
|
61
57
|
|
data/monglobal.gemspec
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: monglobal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.4
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Wylie Thomas
|
@@ -10,10 +10,20 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2013-01-
|
13
|
+
date: 2013-01-14 00:00:00 -07:00
|
14
14
|
default_executable:
|
15
|
-
dependencies:
|
16
|
-
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: paperclip
|
18
|
+
prerelease: false
|
19
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
20
|
+
none: false
|
21
|
+
requirements:
|
22
|
+
- - ">="
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: "0"
|
25
|
+
type: :runtime
|
26
|
+
version_requirements: *id001
|
17
27
|
description: Translates models in Rails for MongoDB
|
18
28
|
email:
|
19
29
|
- wylie@wyliethomas.com
|