traco 3.0.0 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +16 -0
- data/README.md +2 -0
- data/lib/traco/class_methods.rb +4 -0
- data/lib/traco/version.rb +1 -1
- data/spec/traco_spec.rb +11 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a8bd7fc75a987a4f1f791ac9d4e1eec0aed2a63e
|
4
|
+
data.tar.gz: 4089adbb897a21f2eefd3c3ea2cc88ea746705e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 87640e9a6cf728ff073ed250497821582555b47a89c1274c14cdefcde446e39676fbd9091de27ac1f7f4ac373255393787600a1872469d27a858e57a86f44c6e
|
7
|
+
data.tar.gz: 1b64b064d9918cfb1909447dfb2a2f840de1f0f0f5142a4e5583b44b83c652f601557aab24712bff45d9d873a7702820fce21604f5a87e71ecf03fb6b0e64941
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,21 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 3.1.0
|
4
|
+
|
5
|
+
* Introduce `.current_locale_column`, e.g. `Post.current_locale_column(:title) # => :title_sv`.
|
6
|
+
|
7
|
+
## 3.0.0
|
8
|
+
|
9
|
+
* Backwards incompatible: `fallback: true` is now `fallback: :default`. Since this was the implicit default value, you shouldn't have a problem unless you explicitly declared this value.
|
10
|
+
|
11
|
+
## 2.2.0
|
12
|
+
|
13
|
+
* `fallback: :any` to fall back to any other locale if the text is blank in the current and default locales.
|
14
|
+
|
15
|
+
## 2.1.0
|
16
|
+
|
17
|
+
* Attribute readers can override the attribute's `fallback` setting, e.g. `item.title(fallback: false)`.
|
18
|
+
|
3
19
|
## 2.0.0
|
4
20
|
|
5
21
|
* Backwards incompatible: for dashed locales like `:"pt-BR"`, the column names are now expected to end in e.g. `_pt_br`, not `_pt-BR`.
|
data/README.md
CHANGED
@@ -77,6 +77,8 @@ attr_accessible *locale_columns(:title, :body)
|
|
77
77
|
|
78
78
|
The return value will be sorted like `[:title_sv, :title_en, :body_sv, :body_en]`.
|
79
79
|
|
80
|
+
`.current_locale_column(:title)`: Returns `:title_sv` if `:sv` is the current locale. Suitable for some SQL queries, such as sorting.
|
81
|
+
|
80
82
|
`.locales_for_attribute(:title)`: Returns an array like `[:sv, :en]` sorted with default locale first and then alphabetically.
|
81
83
|
|
82
84
|
And the equivalent methods for `body`, of course.
|
data/lib/traco/class_methods.rb
CHANGED
data/lib/traco/version.rb
CHANGED
data/spec/traco_spec.rb
CHANGED
@@ -74,6 +74,17 @@ describe Post, ".locale_columns" do
|
|
74
74
|
end
|
75
75
|
end
|
76
76
|
|
77
|
+
describe Post, ".current_locale_column" do
|
78
|
+
before do
|
79
|
+
Post.translates :title
|
80
|
+
end
|
81
|
+
|
82
|
+
it "returns the column name for the current locale" do
|
83
|
+
I18n.locale = :sv
|
84
|
+
Post.current_locale_column(:title).should == :title_sv
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
77
88
|
describe Post, "#title" do
|
78
89
|
let(:post) {
|
79
90
|
Post.new(title_sv: "Hej", title_en: "Halloa", title_pt_br: "Olá")
|
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: 3.
|
4
|
+
version: 3.1.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: 2014-02-
|
11
|
+
date: 2014-02-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|