From 2a4537b653b14d63c6d6aab0b629b4b5132b9db1 Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Thu, 3 May 2012 01:42:45 -0400 Subject: [PATCH] Update model method to a more appropriate name. --- app/controllers/links_controller.rb | 2 +- app/models/link.rb | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/controllers/links_controller.rb b/app/controllers/links_controller.rb index c0b2a8b..fb67438 100644 --- a/app/controllers/links_controller.rb +++ b/app/controllers/links_controller.rb @@ -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 diff --git a/app/models/link.rb b/app/models/link.rb index d5ad7e9..c60e2a6 100644 --- a/app/models/link.rb +++ b/app/models/link.rb @@ -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