Use built-in active record increment.

This commit is contained in:
Andrew Tomaka 2012-05-04 10:44:22 -04:00
parent ff0b0c59a9
commit eedd12c084

View file

@ -13,8 +13,8 @@ class Link < ActiveRecord::Base
link = nil
Link.transaction do
link = Link.find(id)
link.visits += 1
link.save
#need to rate limit visits increment
link.increment!(:visits)
end
return link