i18n_column 0.0.3 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +7 -4
- data/{Gemfile.rb → Gemfile} +1 -1
- data/README.rdoc +2 -2
- data/Rakefile +1 -3
- data/i18n_column.gemspec +5 -4
- data/lib/i18n_column/base.rb +2 -1
- data/lib/i18n_column/version.rb +1 -1
- data/spec/i18n_column_spec.rb +8 -0
- metadata +41 -24
data/.gitignore
CHANGED
data/{Gemfile.rb → Gemfile}
RENAMED
data/README.rdoc
CHANGED
|
@@ -6,7 +6,7 @@ This extension provides the capabilities of storing and retrieving translations
|
|
|
6
6
|
|
|
7
7
|
The current and default locale are retrieved from the {Rails Internationalization (I18n) API}[http://guides.rubyonrails.org/i18n.html]. Set the current locale on each request with i.e. <tt>I18n.locale = :de</tt>. If not set the default locale will be taken: <tt>I18n.default_locale</tt>. <tt>I18n.locale</tt> is used as the JSON key to store a translation i.e. <tt>"en":"Home"</tt>.
|
|
8
8
|
|
|
9
|
-
<tt>i18n_column</tt> is tested with rails version 3.
|
|
9
|
+
<tt>i18n_column</tt> is tested with rails version 3.1.0
|
|
10
10
|
|
|
11
11
|
== Installation
|
|
12
12
|
|
|
@@ -74,4 +74,4 @@ The current and default locale are retrieved from the {Rails Internationalizatio
|
|
|
74
74
|
|
|
75
75
|
== Copyright
|
|
76
76
|
|
|
77
|
-
Copyright (c)
|
|
77
|
+
Copyright (c) 2011 Philipp Ullmann. See LICENSE for details.
|
data/Rakefile
CHANGED
data/i18n_column.gemspec
CHANGED
|
@@ -6,7 +6,7 @@ Gem::Specification.new do |s|
|
|
|
6
6
|
s.name = 'i18n_column'
|
|
7
7
|
s.version = I18nColumn::VERSION
|
|
8
8
|
s.platform = Gem::Platform::RUBY
|
|
9
|
-
s.authors = ['Philipp Ullmann']
|
|
9
|
+
s.authors = ['Philipp Ullmann', 'René Groß']
|
|
10
10
|
s.email = 'philipp.ullmann@create.at'
|
|
11
11
|
s.homepage = 'http://github.com/create-philipp-ullmann/i18n_column'
|
|
12
12
|
s.summary = 'Storing and retrieving translations from a single database column'
|
|
@@ -19,7 +19,8 @@ Gem::Specification.new do |s|
|
|
|
19
19
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
|
20
20
|
s.require_paths = ['lib']
|
|
21
21
|
|
|
22
|
-
s.add_development_dependency('rspec', ['>= 2.
|
|
23
|
-
s.add_development_dependency('sqlite3
|
|
24
|
-
s.add_development_dependency('activerecord', ['>= 3.0
|
|
22
|
+
s.add_development_dependency('rspec', ['>= 2.6.0'])
|
|
23
|
+
s.add_development_dependency('sqlite3', ['>= 1.3.4'])
|
|
24
|
+
s.add_development_dependency('activerecord', ['>= 3.1.0'])
|
|
25
|
+
s.add_development_dependency('rake', ['0.9.2'])
|
|
25
26
|
end
|
data/lib/i18n_column/base.rb
CHANGED
|
@@ -40,7 +40,8 @@ module I18nColumn
|
|
|
40
40
|
private
|
|
41
41
|
|
|
42
42
|
def decode_#{col_name}
|
|
43
|
-
|
|
43
|
+
val = self[:#{col_name}]
|
|
44
|
+
(val.inspect == "nil" || val.to_s.blank?) ? nil : ::ActiveSupport::JSON::decode(val.to_s)
|
|
44
45
|
end
|
|
45
46
|
EOV
|
|
46
47
|
end
|
data/lib/i18n_column/version.rb
CHANGED
data/spec/i18n_column_spec.rb
CHANGED
|
@@ -88,6 +88,14 @@ describe(I18nColumn::Base) do
|
|
|
88
88
|
end
|
|
89
89
|
end
|
|
90
90
|
end
|
|
91
|
+
|
|
92
|
+
context('column with empty attribute') do
|
|
93
|
+
it('should return nil instead throwing an JSON multibyte error') do
|
|
94
|
+
@node = Node.new
|
|
95
|
+
@node[:name] = ''
|
|
96
|
+
@node.name = 'test'
|
|
97
|
+
end
|
|
98
|
+
end
|
|
91
99
|
|
|
92
100
|
describe('#fname') do
|
|
93
101
|
it('should call method name') do
|
metadata
CHANGED
|
@@ -1,71 +1,89 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: i18n_column
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
5
|
-
prerelease:
|
|
4
|
+
hash: 27
|
|
5
|
+
prerelease:
|
|
6
6
|
segments:
|
|
7
7
|
- 0
|
|
8
|
+
- 1
|
|
8
9
|
- 0
|
|
9
|
-
|
|
10
|
-
version: 0.0.3
|
|
10
|
+
version: 0.1.0
|
|
11
11
|
platform: ruby
|
|
12
12
|
authors:
|
|
13
13
|
- Philipp Ullmann
|
|
14
|
+
- !binary |
|
|
15
|
+
UmVuw6kgR3Jvw58=
|
|
16
|
+
|
|
14
17
|
autorequire:
|
|
15
18
|
bindir: bin
|
|
16
19
|
cert_chain: []
|
|
17
20
|
|
|
18
|
-
date: 2011-
|
|
19
|
-
default_executable:
|
|
21
|
+
date: 2011-09-05 00:00:00 Z
|
|
20
22
|
dependencies:
|
|
21
23
|
- !ruby/object:Gem::Dependency
|
|
22
|
-
name: rspec
|
|
23
24
|
prerelease: false
|
|
25
|
+
type: :development
|
|
24
26
|
requirement: &id001 !ruby/object:Gem::Requirement
|
|
25
27
|
none: false
|
|
26
28
|
requirements:
|
|
27
29
|
- - ">="
|
|
28
30
|
- !ruby/object:Gem::Version
|
|
29
|
-
hash:
|
|
31
|
+
hash: 23
|
|
30
32
|
segments:
|
|
31
33
|
- 2
|
|
32
|
-
-
|
|
34
|
+
- 6
|
|
33
35
|
- 0
|
|
34
|
-
version: 2.
|
|
35
|
-
|
|
36
|
+
version: 2.6.0
|
|
37
|
+
name: rspec
|
|
36
38
|
version_requirements: *id001
|
|
37
39
|
- !ruby/object:Gem::Dependency
|
|
38
|
-
name: sqlite3-ruby
|
|
39
40
|
prerelease: false
|
|
41
|
+
type: :development
|
|
40
42
|
requirement: &id002 !ruby/object:Gem::Requirement
|
|
41
43
|
none: false
|
|
42
44
|
requirements:
|
|
43
45
|
- - ">="
|
|
44
46
|
- !ruby/object:Gem::Version
|
|
45
|
-
hash:
|
|
47
|
+
hash: 19
|
|
46
48
|
segments:
|
|
47
49
|
- 1
|
|
48
50
|
- 3
|
|
49
|
-
-
|
|
50
|
-
version: 1.3.
|
|
51
|
-
|
|
51
|
+
- 4
|
|
52
|
+
version: 1.3.4
|
|
53
|
+
name: sqlite3
|
|
52
54
|
version_requirements: *id002
|
|
53
55
|
- !ruby/object:Gem::Dependency
|
|
54
|
-
name: activerecord
|
|
55
56
|
prerelease: false
|
|
57
|
+
type: :development
|
|
56
58
|
requirement: &id003 !ruby/object:Gem::Requirement
|
|
57
59
|
none: false
|
|
58
60
|
requirements:
|
|
59
61
|
- - ">="
|
|
60
62
|
- !ruby/object:Gem::Version
|
|
61
|
-
hash:
|
|
63
|
+
hash: 3
|
|
62
64
|
segments:
|
|
63
65
|
- 3
|
|
66
|
+
- 1
|
|
64
67
|
- 0
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
type: :development
|
|
68
|
+
version: 3.1.0
|
|
69
|
+
name: activerecord
|
|
68
70
|
version_requirements: *id003
|
|
71
|
+
- !ruby/object:Gem::Dependency
|
|
72
|
+
prerelease: false
|
|
73
|
+
type: :development
|
|
74
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
|
75
|
+
none: false
|
|
76
|
+
requirements:
|
|
77
|
+
- - "="
|
|
78
|
+
- !ruby/object:Gem::Version
|
|
79
|
+
hash: 63
|
|
80
|
+
segments:
|
|
81
|
+
- 0
|
|
82
|
+
- 9
|
|
83
|
+
- 2
|
|
84
|
+
version: 0.9.2
|
|
85
|
+
name: rake
|
|
86
|
+
version_requirements: *id004
|
|
69
87
|
description: This extension provides the capabilities of storing and retrieving translations from a single database column. The translations are serialized using JSON.
|
|
70
88
|
email: philipp.ullmann@create.at
|
|
71
89
|
executables: []
|
|
@@ -76,7 +94,7 @@ extra_rdoc_files: []
|
|
|
76
94
|
|
|
77
95
|
files:
|
|
78
96
|
- .gitignore
|
|
79
|
-
- Gemfile
|
|
97
|
+
- Gemfile
|
|
80
98
|
- LICENSE
|
|
81
99
|
- README.rdoc
|
|
82
100
|
- Rakefile
|
|
@@ -87,7 +105,6 @@ files:
|
|
|
87
105
|
- spec/.rspec
|
|
88
106
|
- spec/i18n_column_spec.rb
|
|
89
107
|
- spec/spec_helper.rb
|
|
90
|
-
has_rdoc: true
|
|
91
108
|
homepage: http://github.com/create-philipp-ullmann/i18n_column
|
|
92
109
|
licenses: []
|
|
93
110
|
|
|
@@ -117,7 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
117
134
|
requirements: []
|
|
118
135
|
|
|
119
136
|
rubyforge_project: i18n_column
|
|
120
|
-
rubygems_version: 1.
|
|
137
|
+
rubygems_version: 1.8.8
|
|
121
138
|
signing_key:
|
|
122
139
|
specification_version: 3
|
|
123
140
|
summary: Storing and retrieving translations from a single database column
|