I'm getting a surprising error. I check if one record's ID matches the ID of another object:
new_post = posts_with_score.detect {|post| post["id"].to_s == original_post.id.to_s }
I get an error TypeError (no implicit conversion of String into Integer). This is surprising since both id's are explicitly converted into strings.
What am I not seeing here? Why is this equality check trying to convert into integers?
Edit:
Here is what post inside the detect looks like: {"time_since_post_in_hours"=>15.810972532939815, "upvote_count"=>324, "id"=>1, "score"=>4.3103601541380465}
postinside the block is an array. the error is about converting a string into integer, not the other way around.post['id'], another asoriginal_post.id, then your conditional as the last line. you should be able to pinpoint the cause of the issue.