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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d8e76f6a921836b0f1eaab3a9c216876050d70b2376b936c641863c88aa8979c
4
- data.tar.gz: 6e2cb9f18f06f3d0408812eb42bd57053ccc9b2acc766a2d5f78dd249e503c7f
3
+ metadata.gz: 8b0fa395bf9d6140de846cf8198420887598969f58cbff6b2f8e76e34dd59849
4
+ data.tar.gz: f3540086ff6da0902232e25ab62f340c58f6a16b96b3eecfecabf665f7732eff
5
5
  SHA512:
6
- metadata.gz: f6bc895fb490fac8fe2c23a9bf7e000dde58330909c36a956d288a0b325583d21cf45dc6c7a897f0752a38e904f33486033e22b4f80efc4c7a7d548d4a79479b
7
- data.tar.gz: c4912b58c78943cdf884be2d3bc5a993fdd7b04984adfba97eca41e00a999cf27e40e81e799f793966fe7f5ff8000a0780b1ce40a2c67565e3eeed1f8a9f886e
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 :with_translations, -> { includes(:translated_text_fields) }
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Translated
4
- VERSION = '0.3.0'
4
+ VERSION = '0.4.0'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: translated
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Trae Robrock