Skip to content

Instantly share code, notes, and snippets.

@Shafaet
Last active February 13, 2016 17:11
Show Gist options
  • Save Shafaet/745b4f86486dfae6b6b7 to your computer and use it in GitHub Desktop.
Save Shafaet/745b4f86486dfae6b6b7 to your computer and use it in GitHub Desktop.
message
list=["user1",user2"]
list.each do |name|
h=Hacker.find_by_username(name)
m=Message.where(receiver_id: h.id)
puts h.id,m
end
#it will output only hackerid's if nobody sent any messages, otherwise it will print list of messages too
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment