diff --git a/app/controllers/choices_controller.rb b/app/controllers/choices_controller.rb index c2c74a3..c49b188 100644 --- a/app/controllers/choices_controller.rb +++ b/app/controllers/choices_controller.rb @@ -8,11 +8,11 @@ class ChoicesController < InheritedResources::Base if params[:limit] @question = Question.find(params[:question_id])#, :include => :choices) @question.reload - @choices = Choice.find(:all, :conditions => {:question_id => @question.id}, :limit => params[:limit].to_i, :order => 'score DESC') + @choices = Choice.find(:all, :conditions => {:question_id => @question.id, :active => true}, :limit => params[:limit].to_i, :order => 'score DESC') @choices.each {|c| c.compute_score!} else @question = Question.find(params[:question_id], :include => :choices) #eagerloads ALL choices - @choices = @question.choices(true) + @choices = @question.choices(true).active @choices.each {|c| c.compute_score!} end index! do |format| diff --git a/app/controllers/clicks_controller.rb b/app/controllers/clicks_controller.rb index cb72b0b..812a2ff 100644 --- a/app/controllers/clicks_controller.rb +++ b/app/controllers/clicks_controller.rb @@ -2,7 +2,7 @@ class ClicksController < ApplicationController # GET /clicks # GET /clicks.xml def index - @clicks = Click.find(:all, :order => 'created_at DESC') + @clicks = Click.find(:all, :order => 'created_at DESC', :limit => 50) respond_to do |format| format.html # index.html.erb diff --git a/lib/activation.rb b/lib/activation.rb index cce9d98..ac31e74 100644 --- a/lib/activation.rb +++ b/lib/activation.rb @@ -1,9 +1,9 @@ module Activation def activate! - (self.active = true) && self.save + (self.active = true) && self.save! end def suspend! - (self.active = false) && self.save + (self.active = false) && self.save! end end \ No newline at end of file -- libgit2 0.21.2