globalize/globalize

dynamic attributes incorrectly returned as nil

shushugah opened this issue · 3 comments

We had bug introduced when upgrading from globalize 4.0.3 to globalize 5.2.0.

we have a color_structure model which looks like the following

ColorStructure < ActiveRecord::Base # rails 4.1
### 
  translates :title, fallbacks_for_empty_translations: true
  globalize_accessors locales: Country::TRANSLATED_LANGUAGES, attributes: [:title]

and we accessed it's title in associated objects via color_structure.try(:title) which now return
nil. As a work around (we use ruby 2.3+) we could use color_structure&.title instead which correctly returned values. Any idea why?

The problem in essence is, object.respond_to?(:title) returns true at version 4.0.3 and false at version 5.2.0.

I made some investigation on this, seems like #711 solves the problem. Is there a plan for making a release with that fix in the near future?

stale commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.