Skip to content

Commit 2d9a22b

Browse files
committed
Merge pull request svenfuchs#50 from agustinf/master
Improves documentation
2 parents 55507cf + c10b1ce commit 2d9a22b

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

README.textile

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,19 @@ A more adavanced example (Thanks Moritz), which uses YAML files and ActiveRecord
5151

5252
<pre>
5353
require 'i18n/backend/active_record'
54-
I18n.backend = I18n::Backend::ActiveRecord.new
55-
56-
I18n::Backend::ActiveRecord.send(:include, I18n::Backend::Memoize)
57-
I18n::Backend::ActiveRecord.send(:include, I18n::Backend::Flatten)
58-
I18n::Backend::Simple.send(:include, I18n::Backend::Memoize)
59-
I18n::Backend::Simple.send(:include, I18n::Backend::Pluralization)
60-
61-
I18n.backend = I18n::Backend::Chain.new(I18n::Backend::Simple.new, I18n.backend)
54+
55+
Translation = I18n::Backend::ActiveRecord::Translation
56+
57+
if Translation.table_exists?
58+
I18n.backend = I18n::Backend::ActiveRecord.new
59+
60+
I18n::Backend::ActiveRecord.send(:include, I18n::Backend::Memoize)
61+
I18n::Backend::ActiveRecord.send(:include, I18n::Backend::Flatten)
62+
I18n::Backend::Simple.send(:include, I18n::Backend::Memoize)
63+
I18n::Backend::Simple.send(:include, I18n::Backend::Pluralization)
64+
65+
I18n.backend = I18n::Backend::Chain.new(I18n::Backend::Simple.new, I18n.backend)
66+
end
6267
</pre>
6368

6469
h2. Usage

0 commit comments

Comments
 (0)