No implicit conversion of String into Integer (TypeError)?

后端 未结 1 1036
情书的邮戳
情书的邮戳 2021-02-01 06:15

I\'m trying to write a script that will get a system ID from Red Hat Satellite/Spacewalk, which uses XMLRPC. I\'m trying to get the ID which is the first value when using the X

相关标签:
1条回答
  • 2021-02-01 06:52

    Write as

    @systemid = @getsystemid[0]['id']
    

    Your @getsystemid is not a Hash, it is an Array of Hash. @getsystemid[0] will give you the intended hash {"id"=>1000010466, "name"=>"cfme038", "last_checkin"=>#}. Now you can use Hash#[] method to access the value of the hash by using its keys.

    0 讨论(0)
提交回复
热议问题