air18n 0.4.6 → 0.4.7

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.
@@ -252,7 +252,10 @@ module Air18n
252
252
  end
253
253
  else
254
254
  # Create the phrase for the first time.
255
- Phrase.create(:key => key, :value => default)
255
+ p = Phrase.create do |p|
256
+ p.key = key
257
+ p.value = default
258
+ end
256
259
  end
257
260
 
258
261
  @translation_data[locale][key] = default
@@ -1,3 +1,3 @@
1
1
  module Air18n
2
- VERSION = "0.4.6"
2
+ VERSION = "0.4.7"
3
3
  end
@@ -23,6 +23,18 @@ describe Air18n::Backend do
23
23
  @scope = []
24
24
  end
25
25
 
26
+ context 'Translation auto-create' do
27
+ before do
28
+ @backend = Air18n::Backend.new
29
+ end
30
+ it 'Should create phrase for new key' do
31
+ @backend.lookup(:en, 'translation auto-create', @scope, :default => 'new_value').should == 'new_value'
32
+ p = Air18n::Phrase.find_by_key('translation auto-create')
33
+ p.key.should == 'translation auto-create'
34
+ p.value.should == 'new_value'
35
+ end
36
+ end
37
+
26
38
  context 'Translation auto-update' do
27
39
  before do
28
40
  @backend = Air18n::Backend.new
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: air18n
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.6
4
+ version: 0.4.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2013-03-28 00:00:00.000000000 Z
16
+ date: 2013-04-01 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: i18n