1

How does column_fallback work?

I've added the line column_fallback to the initializer and set in the model something like:

  extend Mobility
  translates :title, type: :string, column_fallback: true
[2] pry(main)> b.title
=> "Ecologia polĂ­tica"
[3] pry(main)> Mobility.locale = :en
=> :en
[4] pry(main)> b.title
  Mobility::Backends::ActiveRecord::KeyValue::StringTranslation Load (0.3ms)  SELECT "mobility_string_translations".* FROM "mobility_string_translations" WHERE "mobility_string_translations"."translatable_type" = $1 AND "mobility_string_translations"."key" = $2 AND "mobility_string_translations"."translatable_id" = $3  [["translatable_type", "Blox"], ["key", "title"], ["translatable_id", 21342]]
=> nil
Progman
  • 16,827
  • 6
  • 33
  • 48

1 Answers1

0

In config/initializers/mobility.rb inside the Mobility.configure block add:

column_fallback true
Trinculo
  • 1,950
  • 1
  • 17
  • 22