acts_as_translatable 0.3.3 → 0.3.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.
@@ -9,7 +9,7 @@ module ActsAsTranslatable
|
|
9
9
|
# loop through fields to define methods such as "name", "description", and "find_by_name"
|
10
10
|
fields.each do |field|
|
11
11
|
self.class.send :define_method, "find_by_#{field}" do |content|
|
12
|
-
where(["record_translations.locale = ? AND record_translations.content = ?", I18n.locale, content])
|
12
|
+
where(["record_translations.locale = ? AND record_translations.content = ?", I18n.locale, content]).first
|
13
13
|
end
|
14
14
|
|
15
15
|
define_method "#{field}" do
|
@@ -27,7 +27,7 @@ module ActsAsTranslatable
|
|
27
27
|
# loop through fields to define methods such as "name_en", "name_es", and "find_by_name_en"
|
28
28
|
I18n.available_locales.each do |locale|
|
29
29
|
self.class.send :define_method, "find_by_#{field}_#{locale}" do |content|
|
30
|
-
where(["record_translations.locale = ? AND record_translations.content = ?", locale, content])
|
30
|
+
where(["record_translations.locale = ? AND record_translations.content = ?", locale, content]).first
|
31
31
|
end
|
32
32
|
|
33
33
|
define_method "#{field}_#{locale}" do
|
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: 27
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 4
|
10
|
+
version: 0.3.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Lasse Bunk
|