Hey, I am trying to convert this object to an array of ints e.g. array(3,4,6)
- - !ruby/object:Code
attributes:
candidate_id: "3"
attributes_cache: {}
- !ruby/object:Code
attributes:
candidate_id: "4"
attributes_cache: {}
- !ruby/object:Code
attributes:
candidate_id: "6"
attributes_cache: {}
here is what I tried
result = @intersection.map{|c| c.candidate_id}
Thanks
Try the following:
OR
I’m not familiar with YAML, however you might want to try making hashes instead of Code objects. Additionally, if you do use a code class, you should ensure that you have and attr_accessor (and then your old code should work).