title: Check if Array contains true in Rails
body: <p>I am trying to limit failed login attempts per <code>ip</code>.</p>
  
  <p>I have the following:</p>
  
  <pre><code>  def validate(email, context)
      attempt = insert_into_attempts(email, context)
      return nil unless allow_login_by_ip(context.ip_address)
      flag_successful_attempt(attempt, context.ip_address)
      load_data
    end
  
    def allow_login_by_ip(ip_address)
      limit = LoginLimits.new(ip_address).limit
      last_5_attempts = AuthenticationAttempt.select("id","successful").where(ip: ip_address).last(5)
      last_5_attempts.include?("true")
    end 
  
    def insert_into_attempts(email, context)
      attempt = AuthenticationAttempt.new(
        :email =&gt; email,
        :ip =&gt; context.ip_address)
      attempt.save
    end 
  
    def flag_successful_attempt(attempt, ip_address)
      AuthenticationAttempt.where(ip: ip_address).last.update(successful: '1')
    end
  </code></pre>
  
  <p>The issue I am having is that it always returns <code>fasle</code>. I must be searching the <code>array</code> incorrectly but I am not sure why. <code>last_5_attempts</code> is:</p>
  
  <pre><code>#&lt;AuthenticationAttempt id: 1, successful: false&gt;, 
  #&lt;AuthenticationAttempt id: 2, successful: false&gt;, 
  #&lt;AuthenticationAttempt id: 3, successful: true&gt;,
  #&lt;AuthenticationAttempt id: 4, successful: false&gt;, 
  #&lt;AuthenticationAttempt id: 5, successful: false&gt;]
  </code></pre>