From 1227ce7c0802d9eabb01875d74231cdff17d10f6 Mon Sep 17 00:00:00 2001 From: David Gil Date: Wed, 12 Aug 2015 17:34:04 +0200 Subject: [PATCH] clean up tags_count_out_of_limit --- app/models/debate.rb | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/app/models/debate.rb b/app/models/debate.rb index aa7630cd5..fe75811fa 100644 --- a/app/models/debate.rb +++ b/app/models/debate.rb @@ -47,12 +47,10 @@ class Debate < ActiveRecord::Base end def tags_count_out_of_limit(limit = nil) - if limit - count = tags.count - limit - count < 0 ? 0 : count - else - 0 - end + return 0 unless limit + + count = tags.count - limit + count < 0 ? 0 : count end protected