Project

General

Profile

« Previous | Next » 

Revision ff74c383

Added by Lukas Zapletal about 7 years ago

Fixes #18800 - strong params no longer breaks inherited attrs

View differences:

app/models/host/managed.rb
def apply_inherited_attributes(attributes, initialized = true)
return nil unless attributes
#don't change the source to minimize side effects.
attributes = hash_clone(attributes).with_indifferent_access
#convert possible strong parameters to unsafe hash (filtering out unsafe items) and
#clone to minimize side effects
attributes = hash_clone(attributes.to_h).with_indifferent_access
new_hostgroup_id = attributes['hostgroup_id'] || attributes['hostgroup_name'] || attributes['hostgroup'].try(:id)
#hostgroup didn't change, no inheritance needs update.

Also available in: Unified diff