acts_as_translatable 0.3.4 → 0.3.5
Sign up to get free protection for your applications and to get access to all the features.
@@ -8,10 +8,6 @@ module ActsAsTranslatable
|
|
8
8
|
|
9
9
|
# loop through fields to define methods such as "name", "description", and "find_by_name"
|
10
10
|
fields.each do |field|
|
11
|
-
self.class.send :define_method, "find_by_#{field}" do |content|
|
12
|
-
where(["record_translations.locale = ? AND record_translations.content = ?", I18n.locale, content]).first
|
13
|
-
end
|
14
|
-
|
15
11
|
define_method "#{field}" do
|
16
12
|
get_field_content(I18n.locale, field)
|
17
13
|
end
|
@@ -26,10 +22,6 @@ module ActsAsTranslatable
|
|
26
22
|
|
27
23
|
# loop through fields to define methods such as "name_en", "name_es", and "find_by_name_en"
|
28
24
|
I18n.available_locales.each do |locale|
|
29
|
-
self.class.send :define_method, "find_by_#{field}_#{locale}" do |content|
|
30
|
-
where(["record_translations.locale = ? AND record_translations.content = ?", locale, content]).first
|
31
|
-
end
|
32
|
-
|
33
25
|
define_method "#{field}_#{locale}" do
|
34
26
|
get_field_content(locale, field)
|
35
27
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acts_as_translatable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 5
|
10
|
+
version: 0.3.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Lasse Bunk
|