Update model method to a more appropriate name.
This commit is contained in:
parent
43c8e70a14
commit
2a4537b653
2 changed files with 3 additions and 2 deletions
|
@ -15,7 +15,7 @@ class LinksController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
@link = Link.goto(params[:id])
|
@link = Link.get_and_count(params[:id])
|
||||||
|
|
||||||
#update link count
|
#update link count
|
||||||
|
|
||||||
|
|
|
@ -7,9 +7,10 @@ class Link < ActiveRecord::Base
|
||||||
Link.where("DATE(release) <= DATE(?)", Time.now).order("release DESC")
|
Link.where("DATE(release) <= DATE(?)", Time.now).order("release DESC")
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.goto(id = nil)
|
def self.get_and_count(id = nil)
|
||||||
return false if nil
|
return false if nil
|
||||||
|
|
||||||
|
link = nil
|
||||||
Link.transaction do
|
Link.transaction do
|
||||||
link = Link.find(id)
|
link = Link.find(id)
|
||||||
link.visits += 1
|
link.visits += 1
|
||||||
|
|
Loading…
Reference in a new issue