title: Rails showing failed conditional result
body: <p>Here is my method in controller:</p>
  
  <pre><code>def destroy
      logger.info "INCOMING ATTACHMENT #{params[:id]}"
      @prod = ProductAttachment.find(params[:id])
      @product = Product.find(@prod.product_id)
      if params[:id] == @product.cover_id
        logger.info "ATTACHMENT MATCHED"
        @prod = ProductAttachment.where(:product_id =&gt; @prod.product_id)
        logger.info "ATTACHMENT #{@prod.count}"
      else
        logger.info "ATTACHMENT NOT MATCHED"
  
      end
      #@product_attachment.destroy
      respond_to do |format|
        format.html { redirect_to product_attachments_url, notice: 'Product attachment was successfully destroyed.' }
        format.json { head :no_content }
      end
    end
  </code></pre>
  
  <p>Even though my <code>params[:id]</code> is equal to <code>1156</code> and <code>@product.cover_id</code> return <code>1156</code> my conditional loop still print out <code>ATTACHMENT NOT MATCHED</code>. Thanks!!</p>