globalize-accessors 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +4 -4
- data/globalize-accessors.gemspec +3 -3
- data/lib/globalize-accessors.rb +0 -1
- data/lib/globalize-accessors/version.rb +1 -1
- data/test/globalize_accessors_test.rb +0 -28
- metadata +15 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dccc82e877027eeead3d16bd978f4572fc2b20a6
|
4
|
+
data.tar.gz: 01765a2648c21e12b7e8c7e797c307d93fc6a020
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e712daebd70c2fd8c6d6e4f21baa4fad507a22746282fb8182d72c7579ea33b1351bd77d1e97e969bc46a54f007f0903d36ced1aeebb0afcc9c1db23f192d347
|
7
|
+
data.tar.gz: 1b68538eac8757fd852dbbe764d9822d5da5469fcae1382c6bc41ecb12ca4677ea83cbaac558b1d19172de2e074463c30d547c96e58a957e24c6bd37ce87932b
|
data/.travis.yml
CHANGED
data/globalize-accessors.gemspec
CHANGED
@@ -14,10 +14,10 @@ Gem::Specification.new do |s|
|
|
14
14
|
s.required_rubygems_version = ">= 1.3"
|
15
15
|
s.rubyforge_project = "globalize-accessors"
|
16
16
|
|
17
|
-
s.add_dependency "globalize", "
|
18
|
-
|
19
|
-
s.add_development_dependency "rake", "~> 0.9.2"
|
17
|
+
s.add_dependency "globalize", [">= 5.0.0", "~> 5.0"]
|
18
|
+
|
20
19
|
s.add_development_dependency "sqlite3"
|
20
|
+
s.add_development_dependency "rake"
|
21
21
|
s.add_development_dependency "minitest", "~> 5.1"
|
22
22
|
|
23
23
|
s.files = `git ls-files`.split("\n")
|
data/lib/globalize-accessors.rb
CHANGED
@@ -36,7 +36,6 @@ module Globalize::Accessors
|
|
36
36
|
localized_attr_name = localized_attr_name_for(attr_name, locale)
|
37
37
|
|
38
38
|
define_method :"#{localized_attr_name}=" do |value|
|
39
|
-
return if !translation_caches[locale] && value.blank?
|
40
39
|
write_attribute(attr_name, value, :locale => locale)
|
41
40
|
translation_for(locale)[attr_name] = value
|
42
41
|
end
|
@@ -61,34 +61,6 @@ class GlobalizeAccessorsTest < ActiveSupport::TestCase
|
|
61
61
|
assert_equal 0, u.translations.count # count from database
|
62
62
|
end
|
63
63
|
|
64
|
-
test "doesn't build translations without values" do
|
65
|
-
u = Unit.new(:name_en => nil, :title_pl => " ")
|
66
|
-
assert_equal 0, u.translations.size
|
67
|
-
end
|
68
|
-
|
69
|
-
test "doesn't build translations without values even after saving" do
|
70
|
-
u = Unit.new(:name_en => nil, :title_pl => " ")
|
71
|
-
u.save
|
72
|
-
|
73
|
-
# On Rails 4, Globalize will always create an empty translation for
|
74
|
-
# the default locale
|
75
|
-
# On Rails 3, Globalize will never create a translation
|
76
|
-
assert u.translated_locales.exclude?(:pl)
|
77
|
-
end
|
78
|
-
|
79
|
-
test "persisted translations can be set to empty values" do
|
80
|
-
u = Unit.new(:name_en => "test")
|
81
|
-
u.save
|
82
|
-
u.name_en = ""
|
83
|
-
assert_equal "", u.translations.first.name
|
84
|
-
end
|
85
|
-
|
86
|
-
test "not persisted translations can be set to empty values" do
|
87
|
-
u = Unit.new(:name_en => "test")
|
88
|
-
u.name_en = ""
|
89
|
-
assert_equal "", u.translations.first.name
|
90
|
-
end
|
91
|
-
|
92
64
|
test "write on new object and read on saved" do
|
93
65
|
u = Unit.create!(:name_en => "Name en", :title_pl => "Title pl")
|
94
66
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: globalize-accessors
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tomasz Stachewicz
|
@@ -12,52 +12,44 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2015-
|
15
|
+
date: 2015-05-15 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: globalize
|
19
19
|
requirement: !ruby/object:Gem::Requirement
|
20
20
|
requirements:
|
21
|
-
- - "
|
21
|
+
- - ">="
|
22
22
|
- !ruby/object:Gem::Version
|
23
23
|
version: 5.0.0
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '5.0'
|
24
27
|
type: :runtime
|
25
28
|
prerelease: false
|
26
29
|
version_requirements: !ruby/object:Gem::Requirement
|
27
30
|
requirements:
|
28
|
-
- - "
|
31
|
+
- - ">="
|
29
32
|
- !ruby/object:Gem::Version
|
30
33
|
version: 5.0.0
|
31
|
-
- !ruby/object:Gem::Dependency
|
32
|
-
name: bundler
|
33
|
-
requirement: !ruby/object:Gem::Requirement
|
34
|
-
requirements:
|
35
34
|
- - "~>"
|
36
35
|
- !ruby/object:Gem::Version
|
37
|
-
version:
|
38
|
-
type: :development
|
39
|
-
prerelease: false
|
40
|
-
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
requirements:
|
42
|
-
- - "~>"
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
-
version: 1.7.2
|
36
|
+
version: '5.0'
|
45
37
|
- !ruby/object:Gem::Dependency
|
46
|
-
name:
|
38
|
+
name: sqlite3
|
47
39
|
requirement: !ruby/object:Gem::Requirement
|
48
40
|
requirements:
|
49
|
-
- - "
|
41
|
+
- - ">="
|
50
42
|
- !ruby/object:Gem::Version
|
51
|
-
version: 0
|
43
|
+
version: '0'
|
52
44
|
type: :development
|
53
45
|
prerelease: false
|
54
46
|
version_requirements: !ruby/object:Gem::Requirement
|
55
47
|
requirements:
|
56
|
-
- - "
|
48
|
+
- - ">="
|
57
49
|
- !ruby/object:Gem::Version
|
58
|
-
version: 0
|
50
|
+
version: '0'
|
59
51
|
- !ruby/object:Gem::Dependency
|
60
|
-
name:
|
52
|
+
name: rake
|
61
53
|
requirement: !ruby/object:Gem::Requirement
|
62
54
|
requirements:
|
63
55
|
- - ">="
|
@@ -128,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
128
120
|
version: '1.3'
|
129
121
|
requirements: []
|
130
122
|
rubyforge_project: globalize-accessors
|
131
|
-
rubygems_version: 2.4.
|
123
|
+
rubygems_version: 2.4.6
|
132
124
|
signing_key:
|
133
125
|
specification_version: 4
|
134
126
|
summary: Define methods for accessing translated attributes
|