finally got rid of that .each

This commit is contained in:
nilsding 2015-01-14 07:50:27 +01:00
parent f350f2806a
commit 0c97ae60d4

View file

@ -104,8 +104,7 @@ class User < ActiveRecord::Base
# has the user answered +question+ yet?
# @param question [Question]
def answered?(question)
question.answers.each { |a| return true if a.user_id == self.id }
false
question.answers.pluck(:user_id).include? self.id
end
# smiles an answer
@ -121,9 +120,7 @@ class User < ActiveRecord::Base
end
def smiled?(answer)
# TODO: you know what to do here, nilsding
answer.smiles.each { |s| return true if s.user_id == self.id }
false
answer.smiles.pluck(:user_id).include? self.id
end
def display_website