traco 5.1.0 → 5.2.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: '0558c0d88be16881d21c8d132f91237f872f8d6ed718ac9c5f96542fa2a2da29'
4
- data.tar.gz: ef022bdbd5381ed2a5df36e125fd1dbc98423bdb0788a682105b997d9ecca720
3
+ metadata.gz: 978a4848f6b31ac00301a8e43b89b7937a446a261031c699c3edc6cd8207d7f8
4
+ data.tar.gz: 53b5f78c80d4e5bc9a8f16aadba823e2dd258dfec8e754650c63b8e12c5ac318
5
5
  SHA512:
6
- metadata.gz: 7eb1119b6ed4de3f33df0c85b6c82faaedcc48f5982066e037bd2bd0ecd9c666eb4ce52f19845f01ca522b4e5f5ff5bad60ad93f09ac536de56976d67a70e300
7
- data.tar.gz: 64e59646deb593318e26e0363c5b90f76e0f62a85c7702d987a0f8e599abd095ea4cb0fe966b7c2b67ce3102d40390c76c76bf71fc88060a3f4585ecc505fc13
6
+ metadata.gz: a30e150540760c82a82ed68553c298dcade15f9695fbc7af1afb7f2c443e4804233c536c2f1652c7fb3338626bfa610df339f35ea00679b43e14742647fdcc8c
7
+ data.tar.gz: 49a329d6a6b2cc7c2a6d68a21f5f9e2a2dd76327f162f8a1115c04c254ef6aaf3b287b2790e6d96b0f811873f5c46555e8d2c74143fb9bcaf678a51dc66863a4
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 5.2.0
4
+
5
+ * Feature: `locale_columns` without a passed column name returns all locale columns. Thanks to [manuelmeurer](https://github.com/manuelmeurer)!
6
+
3
7
  ## 5.1.0
4
8
 
5
9
  * Feature: Add `fallback: :i18n` to use the fallbacks from `I18n.fallbacks`. Thanks to [sunny](https://github.com/sunny)!
@@ -5,6 +5,8 @@ module Traco
5
5
  end
6
6
 
7
7
  def locale_columns(*attributes)
8
+ attributes = attributes.presence || translatable_attributes
9
+
8
10
  attributes.flat_map { |attribute|
9
11
  _locale_columns_for_attribute(attribute, fallback: LocaleFallbacks::ANY_FALLBACK)
10
12
  }
@@ -1,3 +1,3 @@
1
1
  module Traco
2
- VERSION = "5.1.0"
2
+ VERSION = "5.2.0"
3
3
  end
@@ -113,14 +113,20 @@ RSpec.describe Post, ".locale_columns" do
113
113
  expect(Post.locale_columns(:title)).not_to include(:title_ru)
114
114
  end
115
115
 
116
- it "supports multiple attributes" do
117
- Post.translates :body
116
+ it "supports multiple attributes" do
117
+ Post.translates :body
118
118
 
119
119
  expect(Post.locale_columns(:body, :title)).to eq [
120
120
  :body_en, :body_pt_br, :body_de, :body_sv,
121
121
  :title_en, :title_pt_br, :title_de, :title_sv,
122
122
  ]
123
123
  end
124
+
125
+ it "returns the columns of all translated attributes if no params are supplied" do
126
+ expect(Post.locale_columns).to eq [
127
+ :title_en, :title_pt_br, :title_de, :title_sv
128
+ ]
129
+ end
124
130
  end
125
131
 
126
132
  RSpec.describe Post, ".current_locale_column" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: traco
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.1.0
4
+ version: 5.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henrik Nyh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-14 00:00:00.000000000 Z
11
+ date: 2020-12-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord