I needed to remove the first occurrence of a value from my array.
my_array.delete_at(my_array.index(value_to_find) || my_array.length)
The my_array.length handles the case where the value is not in the array
Related External Links:
I needed to remove the first occurrence of a value from my array.
my_array.delete_at(my_array.index(value_to_find) || my_array.length)
The my_array.length handles the case where the value is not in the array
Related External Links:
Article Topic:Software Development - Rails
Date:January 07, 2016
Want me to help develop your next Ruby-on-Rails project or application?
Contact Me