lib/mongoid/fields.rb in mongoid-7.0.13 vs lib/mongoid/fields.rb in mongoid-7.1.0.rc0

- old
+ new

@@ -1,14 +1,16 @@ +# frozen_string_literal: true # encoding: utf-8 + require "mongoid/fields/standard" require "mongoid/fields/foreign_key" require "mongoid/fields/localized" require "mongoid/fields/validators" module Mongoid - # This module defines behaviour for fields. + # This module defines behavior for fields. module Fields extend ActiveSupport::Concern # For fields defined with symbols use the correct class. # @@ -496,11 +498,10 @@ # # @since 2.4.0 def create_translations_getter(name, meth) generated_methods.module_eval do re_define_method("#{meth}_translations") do - attributes[name] ||= {} - attributes[name].with_indifferent_access + (attributes[name] ||= {}).with_indifferent_access end alias_method :"#{meth}_t", :"#{meth}_translations" end end