dynect_rest icon indicating copy to clipboard operation
dynect_rest copied to clipboard

Fix for 'find' method

Open jghward opened this issue 12 years ago • 1 comments

In the 'find' method, get(fqdn) is expected to return an Array, however if only one record is found it returns Dynect::Resource object (line 85-86 in resource.rb). In this case 'find' would throw a NoMethodError: undefined method `each' for DynectRest::Resource exception.

Thanks for writing this, it has been invaluable in helping me automate my infrastructure.

jghward avatar Jan 30 '13 17:01 jghward

@jghward you can avoid the [] and flatten call by directly passing the get call to Array

Array(get(fqdn)).each

ranjib avatar Aug 23 '13 03:08 ranjib