my_easy_globalize2_accessors 0.0.0 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.1.0
|
@@ -7,14 +7,15 @@ module ActiveRecord
|
|
7
7
|
module ActMethods
|
8
8
|
def globalize_accessors(*attr_names)
|
9
9
|
languages = attr_names
|
10
|
-
attribs =
|
10
|
+
attribs = translated_attribute_names
|
11
11
|
attribs.each do |attr_name|
|
12
12
|
languages.each do |with_locale|
|
13
|
-
|
13
|
+
safe_locale = with_locale.to_s.gsub("-", "_")
|
14
|
+
define_method :"#{attr_name}_#{safe_locale}" do
|
14
15
|
globalize.fetch with_locale, attr_name
|
15
16
|
end
|
16
17
|
|
17
|
-
define_method :"#{attr_name}_#{
|
18
|
+
define_method :"#{attr_name}_#{safe_locale}=" do |val|
|
18
19
|
globalize.stash with_locale, attr_name, val
|
19
20
|
self[attr_name] = val
|
20
21
|
end
|
Binary file
|