Changing attribute values in Generic Object

Hi there,

I read the book and addendum of Peter McGowan about generic objects. I couldn’t find an example of how to change the content of attributes of generic attributes.

go_class = $evm.vmdb(:generic_object_definition).find_by_name("MyGOClass")
new_go = go_class.create_object(:name => "Test and GO",
                                :attribute_1 => 1,
                                :attribute_2 => "test",
                                :attribute_3 => true)
vm = $evm.vmdb(:vm).find_by_name('pemcg-test')
new_go.vms = [vm]!

Is it possible to do something like this:

new_go.attribute_1 = 2

Kind Regards,

new_go.attributes = {attribute_1: "new value"}

@phospi Yes, you can set the attribute the way you specified. You will also need to call “save” to commit the changes.