I have a method that looks for random answers and puts them into an array:
def self.answer_list(user)
answers = Array.new
for i in 1..25
answer = random(user)
if !answer.nil? && !answers.include?(answer)
answers << answer
end
end
return answers
end
the include? method is suposed to not let the record go into the array if it is already there, but it puts it in anyway
How do I compare the new record to make sure something similar is not already inside the array? the record returned from the random method is something like this
return answer = Answer.new(user_id: user.id, contact_id: contact.id, statement_id: statement.id)