From 87232d64ee776da37dabc84fc13c917b192b154d Mon Sep 17 00:00:00 2001 From: Andrew Tomkaa Date: Fri, 4 May 2012 23:41:46 -0400 Subject: [PATCH] Don't return a link if it has not been released. --- app/controllers/links_controller.rb | 2 -- app/models/link.rb | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/links_controller.rb b/app/controllers/links_controller.rb index bbb9195..a01c2b4 100644 --- a/app/controllers/links_controller.rb +++ b/app/controllers/links_controller.rb @@ -17,8 +17,6 @@ class LinksController < ApplicationController def show @link = Link.get_and_count(params[:id]) - #if it's not released, need to error - respond_to do |format| format.html { redirect_to @link.url } format.json { render :json => @link } diff --git a/app/models/link.rb b/app/models/link.rb index 7620654..6df742d 100644 --- a/app/models/link.rb +++ b/app/models/link.rb @@ -17,6 +17,8 @@ class Link < ActiveRecord::Base link.increment!(:visits) end + return false if link.release == nil + return link end end