Skip to content

default values not registering as changed on Resource.new #303

Closed
@mozcomp

Description

@mozcomp

On initialisation of a new resource, attributes set via a property with a default value are not registered as #changed.
When looking at the reason why this happens, I also found that any attribute set using "resource.attribute[:foo]" doesn't register as #changed.
It seems Helpers::DynamicAttributes methods [] & []= aren't overriding the HashWithIndifferentAccess methods, why I don't know.
By changing the way you set the default values, to self.send("#{key}=", value), I can get the desired outcome, however, the resource.attributes[key]= remains an issue.
I can create a PR for the above, but at the end of the day, the underlying problems remains.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions