Alex Zakruzhetskyi Alex Zakruzhetskyi - 7 months ago 37
Ruby Question

Get <a> content via Nokogiri

I'm trying to get a content of

element via
by doing the following:

novelty.title = page.at_css('h1 a')

It saving to database like this:
<a href="a_link_to_a_novelty_title">A title</a>
. So, how can I get only
A title
from the
tag? Thanks.


You can write as below to get the text.

ovelty.title = page.at_css('h1 a').text