Module: WebpageArchivist::WebpageElement

Includes:
ElementWithContent
Included in:
Image, Script, Stylesheet
Defined in:
lib/webpage-archivist/models.rb

Instance Method Summary collapse

Methods included from ElementWithContent

#save_content

Instance Method Details

#validateObject



123
124
125
126
127
128
129
130
131
132
133
134
# File 'lib/webpage-archivist/models.rb', line 123

def validate
  super
  validates_presence [:webpage_id, :uri, :last_fetched, :last_modified, :file_hash]
  validates_max_length 5000, :uri
  if self.uri
    begin
      URI.parse self.uri
    rescue URI::InvalidURIError
      errors.add('uri', "[#{self.uri}] is not a valid uri")
    end
  end
end