I'm aware of how include?
works, however not really clear using it with multidimensional array, or a hash (is this possible with a hash?)
For example, given I have a hash that looks like:
@user.badges => [{:id => 1, :name => 'blahh', :description => 'blah blah blah'}, {:id => 2, :name => 'blahh', :description => 'blah blah blah'}]
Can I see if it has an object with the id of 1 in it like this?
if @user.badges.include?(:id => 1)
# do something
end
It doesn’t seem to work, how I can I write this method properly?