translatable 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -17,6 +17,9 @@ Well,that is pretty much it. Now you can create a model with translations, and
17
17
  switching current locale you will get different translations.
18
18
  If there is no translation available, you will get nil.
19
19
 
20
+ Meanwhile, it validates that the :original_id and :locale are presented, :locale has correct format (two lower letters) and
21
+ verifies that :locale in unique within :original_id scope.
22
+
20
23
  Check out the examples below.
21
24
 
22
25
  == How to use?
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.1.3
data/lib/translatable.rb CHANGED
@@ -190,6 +190,7 @@ module ActiveRecord
190
190
  def translatable_register_properties_for_translatable
191
191
  @translatable[:model].module_eval <<-RUBY, __FILE__, __LINE__ + 1
192
192
  validates :#{@translatable[:locale]}, :presence => true
193
+ validates :#{@translatable[:locale]}, :format => { :with => /[a-z]{2}/}, :if => Proc.new {|record| !record.#{@translatable[:locale]}.blank? }
193
194
  validates :#{@translatable[:locale]}, :uniqueness => { :scope => :#{@translatable[:origin]}_id }
194
195
 
195
196
  belongs_to :#{@translatable[:origin]}, :class_name => "#{self.name}"
data/translatable.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "translatable"
8
- s.version = "0.1.2"
8
+ s.version = "0.1.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["E-Max"]
12
- s.date = "2012-08-18"
12
+ s.date = "2012-08-19"
13
13
  s.description = "This game was build to make whole proccess of working with translation for DM to be almost invisble. That was THE AIM."
14
14
  s.email = "max@studentify.nl"
15
15
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: translatable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-18 00:00:00.000000000Z
12
+ date: 2012-08-19 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord
16
- requirement: &86896860 !ruby/object:Gem::Requirement
16
+ requirement: &74385030 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *86896860
24
+ version_requirements: *74385030
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: i18n
27
- requirement: &86896620 !ruby/object:Gem::Requirement
27
+ requirement: &74384790 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *86896620
35
+ version_requirements: *74384790
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: yard
38
- requirement: &86896380 !ruby/object:Gem::Requirement
38
+ requirement: &74384550 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *86896380
46
+ version_requirements: *74384550
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: jeweler
49
- requirement: &86896140 !ruby/object:Gem::Requirement
49
+ requirement: &74384310 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 1.6.0
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *86896140
57
+ version_requirements: *74384310
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: bundler
60
- requirement: &86895900 !ruby/object:Gem::Requirement
60
+ requirement: &74384070 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: 1.0.0
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *86895900
68
+ version_requirements: *74384070
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: simplecov
71
- requirement: &86895660 !ruby/object:Gem::Requirement
71
+ requirement: &74383830 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: 0.6.0
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *86895660
79
+ version_requirements: *74383830
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: rcov
82
- requirement: &86895420 !ruby/object:Gem::Requirement
82
+ requirement: &74383590 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,7 +87,7 @@ dependencies:
87
87
  version: 1.0.0
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *86895420
90
+ version_requirements: *74383590
91
91
  description: This game was build to make whole proccess of working with translation
92
92
  for DM to be almost invisble. That was THE AIM.
93
93
  email: max@studentify.nl
@@ -129,7 +129,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
129
129
  version: '0'
130
130
  segments:
131
131
  - 0
132
- hash: -150355887
132
+ hash: 853174477
133
133
  required_rubygems_version: !ruby/object:Gem::Requirement
134
134
  none: false
135
135
  requirements: