2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-09-05 08:59:27 +08:00

minor cleanup, using AR querying DSL over raw SQL in some places

This commit is contained in:
Gosha Arinich 2013-02-28 21:54:12 +03:00
parent 93a257707e
commit 6e5399d544
41 changed files with 230 additions and 341 deletions

View file

@ -1,13 +1,12 @@
class IncomingLink < ActiveRecord::Base
belongs_to :topic
validates :domain, :length => { :in => 1..100 }
validates :referer, :length => { :in => 3..1000 }
validates :domain, length: { in: 1..100 }
validates :referer, length: { in: 3..1000 }
validates_presence_of :url
# Extract the domain
before_validation do
# Referer (remote URL)
if referer.present?
parsed = URI.parse(referer)
@ -27,7 +26,6 @@ class IncomingLink < ActiveRecord::Base
# If we can't route to the url, that's OK. Don't save those two fields.
end
end
end
# Update appropriate incoming link counts
@ -43,5 +41,4 @@ class IncomingLink < ActiveRecord::Base
end
end
end
end