globalize3 0.2.0.beta3 → 0.2.0.beta4

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/Gemfile CHANGED
@@ -1,2 +1,9 @@
1
1
  source :rubygems
2
+
2
3
  gemspec
4
+
5
+ gem 'ruby-debug', :platform => :mri_18
6
+ gem 'ruby-debug19', :platform => :mri_19 if RUBY_VERSION < '1.9.3'
7
+
8
+ gem 'activerecord', '3.0.10'
9
+ gem 'activemodel', '3.0.10'
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- globalize3 (0.2.0.beta2)
4
+ globalize3 (0.2.0.beta4)
5
5
  activemodel (>= 3.0.0)
6
6
  activerecord (>= 3.0.0)
7
7
  paper_trail (~> 2)
@@ -10,12 +10,12 @@ GEM
10
10
  remote: http://rubygems.org/
11
11
  specs:
12
12
  abstract (1.0.0)
13
- actionmailer (3.0.9)
14
- actionpack (= 3.0.9)
13
+ actionmailer (3.0.10)
14
+ actionpack (= 3.0.10)
15
15
  mail (~> 2.2.19)
16
- actionpack (3.0.9)
17
- activemodel (= 3.0.9)
18
- activesupport (= 3.0.9)
16
+ actionpack (3.0.10)
17
+ activemodel (= 3.0.10)
18
+ activesupport (= 3.0.10)
19
19
  builder (~> 2.1.2)
20
20
  erubis (~> 2.6.6)
21
21
  i18n (~> 0.5.0)
@@ -23,27 +23,29 @@ GEM
23
23
  rack-mount (~> 0.6.14)
24
24
  rack-test (~> 0.5.7)
25
25
  tzinfo (~> 0.3.23)
26
- activemodel (3.0.9)
27
- activesupport (= 3.0.9)
26
+ activemodel (3.0.10)
27
+ activesupport (= 3.0.10)
28
28
  builder (~> 2.1.2)
29
29
  i18n (~> 0.5.0)
30
- activerecord (3.0.9)
31
- activemodel (= 3.0.9)
32
- activesupport (= 3.0.9)
30
+ activerecord (3.0.10)
31
+ activemodel (= 3.0.10)
32
+ activesupport (= 3.0.10)
33
33
  arel (~> 2.0.10)
34
34
  tzinfo (~> 0.3.23)
35
- activeresource (3.0.9)
36
- activemodel (= 3.0.9)
37
- activesupport (= 3.0.9)
38
- activesupport (3.0.9)
35
+ activeresource (3.0.10)
36
+ activemodel (= 3.0.10)
37
+ activesupport (= 3.0.10)
38
+ activesupport (3.0.10)
39
39
  archive-tar-minitar (0.5.2)
40
40
  arel (2.0.10)
41
41
  builder (2.1.2)
42
- columnize (0.3.2)
42
+ columnize (0.3.4)
43
43
  database_cleaner (0.5.2)
44
44
  erubis (2.6.6)
45
45
  abstract (>= 1.0.0)
46
46
  i18n (0.5.0)
47
+ linecache (0.46)
48
+ rbx-require-relative (> 0.0.4)
47
49
  linecache19 (0.5.12)
48
50
  ruby_core_source (>= 0.1.4)
49
51
  mail (2.2.19)
@@ -51,10 +53,11 @@ GEM
51
53
  i18n (>= 0.4.0)
52
54
  mime-types (~> 1.16)
53
55
  treetop (~> 1.4.8)
56
+ metaclass (0.0.1)
54
57
  mime-types (1.16)
55
- mocha (0.9.10)
56
- rake
57
- paper_trail (2.2.9)
58
+ mocha (0.10.0)
59
+ metaclass (~> 0.0.1)
60
+ paper_trail (2.3.2)
58
61
  rails (~> 3)
59
62
  pathname_local (0.0.2)
60
63
  polyglot (0.3.2)
@@ -63,22 +66,28 @@ GEM
63
66
  rack (>= 1.0.0)
64
67
  rack-test (0.5.7)
65
68
  rack (>= 1.0)
66
- rails (3.0.9)
67
- actionmailer (= 3.0.9)
68
- actionpack (= 3.0.9)
69
- activerecord (= 3.0.9)
70
- activeresource (= 3.0.9)
71
- activesupport (= 3.0.9)
69
+ rails (3.0.10)
70
+ actionmailer (= 3.0.10)
71
+ actionpack (= 3.0.10)
72
+ activerecord (= 3.0.10)
73
+ activeresource (= 3.0.10)
74
+ activesupport (= 3.0.10)
72
75
  bundler (~> 1.0)
73
- railties (= 3.0.9)
74
- railties (3.0.9)
75
- actionpack (= 3.0.9)
76
- activesupport (= 3.0.9)
76
+ railties (= 3.0.10)
77
+ railties (3.0.10)
78
+ actionpack (= 3.0.10)
79
+ activesupport (= 3.0.10)
77
80
  rake (>= 0.8.7)
78
81
  rdoc (~> 3.4)
79
82
  thor (~> 0.14.4)
80
- rake (0.8.7)
81
- rdoc (3.9.2)
83
+ rake (0.9.2)
84
+ rbx-require-relative (0.0.5)
85
+ rdoc (3.9.4)
86
+ ruby-debug (0.10.4)
87
+ columnize (>= 0.1)
88
+ ruby-debug-base (~> 0.10.4.0)
89
+ ruby-debug-base (0.10.4)
90
+ linecache (>= 0.3)
82
91
  ruby-debug-base19 (0.11.25)
83
92
  columnize (>= 0.3.1)
84
93
  linecache19 (>= 0.5.11)
@@ -89,7 +98,7 @@ GEM
89
98
  ruby-debug-base19 (>= 0.11.19)
90
99
  ruby_core_source (0.1.5)
91
100
  archive-tar-minitar (>= 0.5.2)
92
- sqlite3-ruby (1.3.2)
101
+ sqlite3 (1.3.4)
93
102
  test_declarative (0.0.5)
94
103
  thor (0.14.6)
95
104
  treetop (1.4.10)
@@ -101,10 +110,13 @@ PLATFORMS
101
110
  ruby
102
111
 
103
112
  DEPENDENCIES
113
+ activemodel (= 3.0.10)
114
+ activerecord (= 3.0.10)
104
115
  database_cleaner (= 0.5.2)
105
116
  globalize3!
106
117
  mocha
107
118
  pathname_local
119
+ ruby-debug
108
120
  ruby-debug19
109
- sqlite3-ruby
121
+ sqlite3
110
122
  test_declarative
@@ -37,13 +37,16 @@ module Globalize
37
37
 
38
38
  def save_translations!
39
39
  stash.each do |locale, attrs|
40
- translation = record.translations.find_or_initialize_by_locale(locale.to_s)
41
- attrs.each { |name, value| translation[name] = value }
42
- translation.save!
40
+ if attrs.any?
41
+ translation = record.translations.find_or_initialize_by_locale(locale.to_s)
42
+ attrs.each { |name, value| translation[name] = value }
43
+ translation.save!
44
+ end
43
45
  end
46
+
44
47
  record.translations.each(&:reload)
45
48
  record.translations.reset
46
- stash.clear
49
+ reset
47
50
  end
48
51
 
49
52
  def reset
@@ -34,7 +34,9 @@ module Globalize
34
34
  end
35
35
  options = {:locale => nil}.merge(options)
36
36
  attribute_will_change! name.to_s
37
- globalize.write(options[:locale] || Globalize.locale, name, value)
37
+ the_locale = options[:locale] || Globalize.locale
38
+ self.translations.reject!{|t| t.new_record? && t.locale != the_locale}
39
+ globalize.write(the_locale, name, value)
38
40
  else
39
41
  super(name, value)
40
42
  end
@@ -113,7 +115,7 @@ module Globalize
113
115
  def translation_for(locale)
114
116
  @translation_caches ||= {}
115
117
  unless @translation_caches[locale]
116
- # Enumberable#detect is better since we have the translations collection (already) loaded
118
+ # Enumberable#detect is better since we have the translations collection (already) loaded
117
119
  # using either Model.includes(:translations) or Model.with_translations
118
120
  _translation = translations.detect{|t| t.locale.to_s == locale.to_s}
119
121
  _translation ||= translations.build(:locale => locale)
@@ -1,3 +1,3 @@
1
1
  module Globalize3
2
- VERSION = '0.2.0.beta3'
2
+ VERSION = '0.2.0.beta4'
3
3
  end
metadata CHANGED
@@ -1,26 +1,28 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: globalize3
3
3
  version: !ruby/object:Gem::Version
4
- hash: 62196357
4
+ hash: 62196363
5
5
  prerelease: 6
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
9
  - 0
10
10
  - beta
11
- - 3
12
- version: 0.2.0.beta3
11
+ - 4
12
+ version: 0.2.0.beta4
13
13
  platform: ruby
14
14
  authors:
15
15
  - Sven Fuchs
16
16
  - Joshua Harvey
17
17
  - Clemens Kofler
18
18
  - John-Paul Bader
19
+ - Tomasz Stachewicz
20
+ - Philip Arndt
19
21
  autorequire:
20
22
  bindir: bin
21
23
  cert_chain: []
22
24
 
23
- date: 2011-08-16 00:00:00 Z
25
+ date: 2011-09-13 00:00:00 Z
24
26
  dependencies:
25
27
  - !ruby/object:Gem::Dependency
26
28
  name: activerecord
@@ -127,7 +129,7 @@ dependencies:
127
129
  type: :development
128
130
  version_requirements: *id007
129
131
  - !ruby/object:Gem::Dependency
130
- name: ruby-debug
132
+ name: sqlite3
131
133
  prerelease: false
132
134
  requirement: &id008 !ruby/object:Gem::Requirement
133
135
  none: false
@@ -140,20 +142,6 @@ dependencies:
140
142
  version: "0"
141
143
  type: :development
142
144
  version_requirements: *id008
143
- - !ruby/object:Gem::Dependency
144
- name: sqlite3-ruby
145
- prerelease: false
146
- requirement: &id009 !ruby/object:Gem::Requirement
147
- none: false
148
- requirements:
149
- - - ">="
150
- - !ruby/object:Gem::Version
151
- hash: 3
152
- segments:
153
- - 0
154
- version: "0"
155
- type: :development
156
- version_requirements: *id009
157
145
  description: "Rails I18n: de-facto standard library for ActiveRecord 3 model/data translation."
158
146
  email: nobody@globalize-rails.org
159
147
  executables: []
@@ -217,7 +205,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
217
205
  requirements: []
218
206
 
219
207
  rubyforge_project: "[none]"
220
- rubygems_version: 1.8.6
208
+ rubygems_version: 1.8.10
221
209
  signing_key:
222
210
  specification_version: 3
223
211
  summary: "Rails I18n: de-facto standard library for ActiveRecord 3 model/data translation"