Use built-in active record increment.
This commit is contained in:
parent
ff0b0c59a9
commit
eedd12c084
1 changed files with 2 additions and 2 deletions
|
@ -13,8 +13,8 @@ class Link < ActiveRecord::Base
|
||||||
link = nil
|
link = nil
|
||||||
Link.transaction do
|
Link.transaction do
|
||||||
link = Link.find(id)
|
link = Link.find(id)
|
||||||
link.visits += 1
|
#need to rate limit visits increment
|
||||||
link.save
|
link.increment!(:visits)
|
||||||
end
|
end
|
||||||
|
|
||||||
return link
|
return link
|
||||||
|
|
Loading…
Reference in a new issue