monglobal 0.0.3 → 0.0.4

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.
@@ -1,3 +1,3 @@
1
1
  module Monglobal
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
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
- (LANGS - [I18n.default_locale]).each do |lang|
35
- attrs = params[lang.to_s]
36
- if attrs
37
- tr = translation_class.new(attrs)
38
- tr.locale = lang.to_s
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
@@ -19,4 +19,6 @@ Gem::Specification.new do |s|
19
19
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
20
  s.require_paths = ["lib"]
21
21
 
22
+ s.add_dependency('paperclip')
23
+
22
24
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: monglobal
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.3
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-03 00:00:00 -07:00
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