easy_translatable 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/translatable/active_record/translate.rb +7 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dcd641aad3b080b3e3227320945bdceb7344b62d
|
4
|
+
data.tar.gz: f1af1cbf318efb5a3b4d536bd8f4b39c351898b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c1d40a073ef3d8d550f301f7669aa8d958e463df1f6d9dd9920ff4bafea22dbc2827217a4c5e90942ae3037084a4807f09fa3560eda3f349af570f208bd7322
|
7
|
+
data.tar.gz: 67d46cc2a3762f396d9ee3c889bdb762bdb78d322ecc0bf2da54a6b9684a130a0eb2e0773b9956311f3624a3c9615ff429b1075d9062effcc3131d83a2e501d1
|
@@ -18,7 +18,6 @@ module Translatable
|
|
18
18
|
to_translate.each do |attr|
|
19
19
|
|
20
20
|
if is_in_scope? attr
|
21
|
-
p "in_scope? attr : #{is_in_scope? attr}"
|
22
21
|
index += 1
|
23
22
|
if Translatable::Config.list[model].include?(attr.to_s)
|
24
23
|
q = q.joins("LEFT JOIN snippets sn#{index} ON sn#{index}.record_id = #{model}.id AND sn#{index}.scope = '#{model}' AND sn#{index}.group_id = #{model}.group_id AND sn#{index}.lang = '#{lang}' AND sn#{index}.key = '#{attr}'").
|
@@ -46,7 +45,13 @@ module Translatable
|
|
46
45
|
def is_in_scope?(attr)
|
47
46
|
|
48
47
|
if has_select_values?
|
49
|
-
select_values = self.scoped.select_values
|
48
|
+
select_values = self.scoped.select_values.map { |one|
|
49
|
+
if one.is_a?(String)
|
50
|
+
one.split(',').map(&:lstrip).map(&:rstrip)
|
51
|
+
else
|
52
|
+
one
|
53
|
+
end
|
54
|
+
}.flatten
|
50
55
|
select_values.select{ |value| value.is_a?(String) && value.split('.').last == '*' }.length > 0 ||
|
51
56
|
select_values.include?(attr) ||
|
52
57
|
select_values.include?(attr.to_sym) ||
|