Uploaded image for project: 'Mongoid'
  1. Mongoid
  2. MONGOID-5290

Criteria#only with localized fields + I18n fallbacks broken on old I18n version 1.0

    • Type: Icon: Bug Bug
    • Resolution: Unresolved
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: Attributes

      As per MONGOID-5263 I believe some specs are broken when using old I18n version with I18n fallbacks. Here's an example from this test run: https://github.com/mongodb/mongoid/runs/6011508153?check_suite_focus=true

      which was exposed in this PR: https://github.com/mongodb/mongoid/pull/5221

      In my opinion the easiest fix would be to require a more recent version of I18n, I suspect >= 1.1 will be sufficient as I think it had the breaking change https://github.com/ruby-i18n/i18n/releases/tag/v1.1.0

      we should double-check but as far as I know, I18n 1.1+ works fine on all supported Rails versions.

       

        9) Mongoid::Criteria#only when the field is localized when a specific locale is included returns the field value for the included locale
      407     Failure/Error: object[::I18n.fallbacks[locale].map(&:to_s).find{ |loc| object.has_key?(loc) }]
      408     
      409     TypeError:
      410       no implicit conversion of Symbol into Integer
      411     # ./lib/mongoid/fields/localized.rb:79:in `lookup'
      412     # ./lib/mongoid/fields/localized.rb:18:in `demongoize'
      413     # ./lib/mongoid/fields.rb:600:in `block (2 levels) in create_field_getter'
      414     # ./spec/mongoid/criteria_projection_spec.rb:202:in `block (5 levels) in <top (required)>'
      415     # ./spec/lite_spec_helper.rb:74:in `block (3 levels) in <top (required)>'
      416     # ./spec/lite_spec_helper.rb:73:in `block (2 levels) in <top (required)>' 

       

       

            Assignee:
            Unassigned Unassigned
            Reporter:
            shields@tablecheck.com Johnny Shields
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: