translated 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/concerns/translated/translatable.rb +13 -1
- data/lib/translated/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8b0fa395bf9d6140de846cf8198420887598969f58cbff6b2f8e76e34dd59849
|
4
|
+
data.tar.gz: f3540086ff6da0902232e25ab62f340c58f6a16b96b3eecfecabf665f7732eff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 77eaf5e0c292f4b52a034ca2fb2ec492bd9dbf770dab1bd2f2b71c394ff98888a733c84fabcca7feb8984398f2d8e6c5a8d6cdf06d795336789e9d95d7437163
|
7
|
+
data.tar.gz: 7eab53083e0a4c1aa3b1edb1dd69536780220e45d377e70749681585a5f41c57ca7be4ffdb8bfd31c82ef39ac7f7247c3e8f52233d00b32b8420d8a4cf11be93
|
@@ -23,6 +23,10 @@ module Translated
|
|
23
23
|
content
|
24
24
|
end
|
25
25
|
|
26
|
+
def #{name}_changed?
|
27
|
+
#{name}_translation_changed? || super
|
28
|
+
end
|
29
|
+
|
26
30
|
private
|
27
31
|
|
28
32
|
def #{name}_translation_changed?
|
@@ -40,7 +44,15 @@ module Translated
|
|
40
44
|
|
41
45
|
validates name, validates if validates.present?
|
42
46
|
|
43
|
-
scope :
|
47
|
+
scope :"with_#{name}_translation", -> { includes(:"#{name}_translation") }
|
48
|
+
end
|
49
|
+
|
50
|
+
def with_translations
|
51
|
+
includes(translation_association_names)
|
52
|
+
end
|
53
|
+
|
54
|
+
def translation_association_names
|
55
|
+
reflect_on_all_associations(:has_one).map(&:name).select { |n| n.ends_with?('_translation') }
|
44
56
|
end
|
45
57
|
|
46
58
|
def has_translated_rich_text(name) # rubocop:disable Naming/PredicateName
|
data/lib/translated/version.rb
CHANGED