Skip to content

Commit

Permalink
Move the nil exclusion to the query
Browse files Browse the repository at this point in the history
  • Loading branch information
CoralineAda committed Aug 31, 2024
1 parent 1e436a5 commit f0c0bd8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/controllers/questions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ class QuestionsController < ApplicationController

def show
@question = Question.from(params[:id])
@responses = SurveyResponse.all.order(:created_at).reject{|sr| sr.read_attribute(@question.key).nil? }
@responses = SurveyResponse.where("#{@question.key} IS NOT NULL").order(:created_at)
end

end

0 comments on commit f0c0bd8

Please sign in to comment.