localizable 1.1 → 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/lib/localizable.rb +5 -1
- data/lib/localizable/hash.rb +19 -0
- metadata +2 -1
data/lib/localizable.rb
CHANGED
@@ -40,7 +40,7 @@ module Localizable
|
|
40
40
|
module ClassMethods
|
41
41
|
|
42
42
|
def localized_key (fieldname, type = String)
|
43
|
-
key fieldname, Hash
|
43
|
+
key fieldname, Localizable::Hash
|
44
44
|
localized_type[fieldname] = type
|
45
45
|
|
46
46
|
self.class_eval <<-end_eval
|
@@ -77,6 +77,8 @@ module Localizable
|
|
77
77
|
end
|
78
78
|
|
79
79
|
def store_localized_values (fieldname, mapping)
|
80
|
+
self[fieldname] ||= Localizable::Hash.new
|
81
|
+
|
80
82
|
mapping.each do |locale, value|
|
81
83
|
self[fieldname][locale] = localized_type[fieldname].to_mongo(value)
|
82
84
|
end
|
@@ -89,4 +91,6 @@ module Localizable
|
|
89
91
|
|
90
92
|
end
|
91
93
|
|
94
|
+
autoload :Hash, File.dirname(__FILE__) + "/localizable/hash"
|
95
|
+
|
92
96
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: localizable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '1.
|
4
|
+
version: '1.2'
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -17,6 +17,7 @@ executables: []
|
|
17
17
|
extensions: []
|
18
18
|
extra_rdoc_files: []
|
19
19
|
files:
|
20
|
+
- lib/localizable/hash.rb
|
20
21
|
- lib/localizable.rb
|
21
22
|
- README
|
22
23
|
homepage:
|