aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/translation.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/lib/active_record/translation.rb')
-rw-r--r--activerecord/lib/active_record/translation.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/translation.rb b/activerecord/lib/active_record/translation.rb
new file mode 100644
index 0000000000..82661a328a
--- /dev/null
+++ b/activerecord/lib/active_record/translation.rb
@@ -0,0 +1,24 @@
+# frozen_string_literal: true
+
+module ActiveRecord
+ module Translation
+ include ActiveModel::Translation
+
+ # Set the lookup ancestors for ActiveModel.
+ def lookup_ancestors #:nodoc:
+ klass = self
+ classes = [klass]
+ return classes if klass == ActiveRecord::Base
+
+ while !klass.base_class?
+ classes << klass = klass.superclass
+ end
+ classes
+ end
+
+ # Set the i18n scope to overwrite ActiveModel.
+ def i18n_scope #:nodoc:
+ :activerecord
+ end
+ end
+end