air18n 0.4.3 → 0.4.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -144,13 +144,14 @@ module Air18n
144
144
  response_obj
145
145
  end
146
146
 
147
+ # Returns the previous translation, or nil if there was none.
148
+ #
149
+ # May return a phrase translation with a different source_hash.
147
150
  def previous_translation
148
151
  PhraseTranslation.where(:locale => locale,
149
- :phrase_id => phrase_id,
150
- :source_hash => source_hash).
151
- where("created_at < ?", created_at).
152
- order("created_at DESC").
153
- first
152
+ :phrase_id => phrase_id).
153
+ where('`phrase_translations`.id < ?', id).
154
+ last
154
155
  end
155
156
 
156
157
  # Computes monthly activity for months between opts[:since] and opts[:to].
@@ -1,3 +1,3 @@
1
1
  module Air18n
2
- VERSION = "0.4.3"
2
+ VERSION = "0.4.4"
3
3
  end
@@ -65,8 +65,8 @@ describe Air18n::PhraseTranslation do
65
65
  :phrase => phrase,
66
66
  :value => "third translation")
67
67
 
68
- # There was no previous translation of 'updated val'
69
- third_translation.previous_translation.should == nil
68
+ # This method returns the last translation, even if source
69
+ third_translation.previous_translation.value.should == "second translation"
70
70
  end
71
71
 
72
72
  context 'validations' do
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.3
4
+ version: 0.4.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: