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.transaction do
|
||||
link = Link.find(id)
|
||||
link.visits += 1
|
||||
link.save
|
||||
#need to rate limit visits increment
|
||||
link.increment!(:visits)
|
||||
end
|
||||
|
||||
return link
|
||||
|
|
Loading…
Reference in a new issue