app/helpers/activity_helper.rb
def search_for_first_image(doc)
      @first_image = doc.css('img')
                        .map { |i| i.attribute('src') }
                        .compact
                        .map(&method(:absolutize_url))
                        .first
    end
# Look for the first image in the document with a src attribute
Look for the first image in the document with a src attribute
Look for the first image in the document with a src attribute
def search_for_first_image(doc)
      @first_image = doc.css('img')
                        .map { |i| i.attribute('src') }
                        .compact
                        .map(&method(:absolutize_url))
                        .first
    end
def search_for_first_image ( doc ) @first_image = doc . css ( 'img' ) . map { | i | i . attribute ( 'src' ) } . compact . map ( & method ( :absolutize_url ) ) . first end
Look for the first image in the document with a src attribute
Look for the first image in the document with a src attribute
doc