-
Notifications
You must be signed in to change notification settings - Fork 93
Open
Description
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)
endAt 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?
Metadata
Metadata
Assignees
Labels
No labels