This method was introduced in Rails 6.0. It can be used to take an array and create a hash where the elements of the array are the indexes of the hash.
24 lines
585 B
Ruby
24 lines
585 B
Ruby
module Globalize
|
|
module ActiveRecord
|
|
module InstanceMethods
|
|
def save(*)
|
|
# Credit for this code belongs to Jack Tomaszewski:
|
|
# https://github.com/globalize/globalize/pull/578
|
|
Globalize.with_locale(Globalize.locale || I18n.default_locale) do
|
|
super
|
|
end
|
|
end
|
|
end
|
|
|
|
class Translation
|
|
include SkipValidation
|
|
end
|
|
end
|
|
end
|
|
|
|
def Globalize.set_fallbacks_to_all_available_locales
|
|
Globalize.fallbacks = I18n.available_locales.index_with do |locale|
|
|
(I18n.fallbacks[locale] + I18n.available_locales).uniq
|
|
end
|
|
end
|