Update model method to a more appropriate name.

This commit is contained in:
Andrew Tomaka 2012-05-03 01:42:45 -04:00
parent 43c8e70a14
commit 2a4537b653
2 changed files with 3 additions and 2 deletions

View file

@ -15,7 +15,7 @@ class LinksController < ApplicationController
end
def show
@link = Link.goto(params[:id])
@link = Link.get_and_count(params[:id])
#update link count

View file

@ -7,9 +7,10 @@ class Link < ActiveRecord::Base
Link.where("DATE(release) <= DATE(?)", Time.now).order("release DESC")
end
def self.goto(id = nil)
def self.get_and_count(id = nil)
return false if nil
link = nil
Link.transaction do
link = Link.find(id)
link.visits += 1