There seems to be an issue with attr readers in some configuration of model after_create/save hooks. See also original issue mrbrdo/spree_mobility#6
Code triggering the issue (in Spree project if you are familiar):
after_create :set_root
after_save :set_root_taxon_name
private
def set_root
self.root ||= Taxon.create!(taxonomy_id: id, name: name)
end
def set_root_taxon_name
return unless saved_change_to_name?
return if name.to_s == root.name.to_s
root.update(name: name)
end
At some point here, Taxon's name (for translation) is set to nil, although a non-nil value was given to base model. It has something to do with the save hooks, it seems. Since I have a validation on the translation model's name presence, the validation fails. Do you have any idea what could be the issue here?
There seems to be an issue with attr readers in some configuration of model after_create/save hooks. See also original issue mrbrdo/spree_mobility#6
Code triggering the issue (in Spree project if you are familiar):
At some point here, Taxon's name (for translation) is set to nil, although a non-nil value was given to base model. It has something to do with the save hooks, it seems. Since I have a validation on the translation model's name presence, the validation fails. Do you have any idea what could be the issue here?