You can use the same algorithm, just don't call split on the field. Or better yet, call the array's index function. It returns the index in the array where the specified element is found.
event['IndexValue'] = event['id'].index(7)
This isn't a Ruby forum so I'll stop here.