Skip to content

Instantly share code, notes, and snippets.

@devton
Created February 10, 2015 23:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save devton/4e58f7d2a50ae356b4bb to your computer and use it in GitHub Desktop.
Save devton/4e58f7d2a50ae356b4bb to your computer and use it in GitHub Desktop.
CrawledUrl Model
class CrawledUrl < ActiveRecord::Base
# Persiste uma URL no banco de dados
# caso ela já não tenha sido persistida ou
# não tenha nenhuma expressão negativa
def self.persist_from url
self.find_or_create_by ::Crawler::UrlParser.parse(url) unless NegativeExpression.url_match?(url)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment