From eedd12c084c5fc173d1a53f1a83f4cc745273dd1 Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Fri, 4 May 2012 10:44:22 -0400 Subject: [PATCH] Use built-in active record increment. --- app/models/link.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/link.rb b/app/models/link.rb index c60e2a6..7620654 100644 --- a/app/models/link.rb +++ b/app/models/link.rb @@ -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