air18n 0.4.3 → 0.4.4
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.
@@ -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
|
-
|
151
|
-
|
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].
|
data/lib/air18n/version.rb
CHANGED
@@ -65,8 +65,8 @@ describe Air18n::PhraseTranslation do
|
|
65
65
|
:phrase => phrase,
|
66
66
|
:value => "third translation")
|
67
67
|
|
68
|
-
#
|
69
|
-
third_translation.previous_translation.should ==
|
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
|