title: How to avoid duplicate data in my database in ruby on rails
body: <p>I have scrap a data from another website and saved it in my database which is working fine. However, anytime I refresh my application the scrapped data duplicate itself in my database.Any help would be highly appreciated. Below are my code</p>
  
  <pre><code>require 'open-uri'
  require 'nokogiri'
  doc = Nokogiri::HTML(open("www.example.com"))
  entries = doc.css('.block')
  @entriesArray = []
  entries.each do |row|
      Scrap.create!(                  
      title: title = row.css('h2&gt;a').text,
      link:  link = row.css('a')[0]['href'],
      day:   days =row.css('time').text)
      @entriesArray &lt;&lt; Entry.new(title,link,days)
  end
  </code></pre>