diff options
Diffstat (limited to 'app/controllers/forumthreads_controller.rb')
-rw-r--r-- | app/controllers/forumthreads_controller.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/app/controllers/forumthreads_controller.rb b/app/controllers/forumthreads_controller.rb index 8827f89..81d420a 100644 --- a/app/controllers/forumthreads_controller.rb +++ b/app/controllers/forumthreads_controller.rb @@ -3,11 +3,11 @@ class ForumthreadsController < ApplicationController before_filter :check_permission, only: [:show, :edit, :update, :destroy] def index - params[:id] = nil if params[:id] && !Forum.find_by(id: params[:id]) + params[:forum] = nil if params[:forum] && !Forum.find_by(id: params[:forum]) - params.each {|k,v| params[k] = nil if v==""} + params.delete_if{|k,v| v.blank?} - @threads = Forumthread.filter(current_user, params[:title], params[:content], params[:reply], params[:label], User.find_by(ign: params[:author].to_s.strip) || params[:author], params[:query], Forum.find_by(id: params[:id])) + @threads = Forumthread.filter(current_user, params[:title].try(:slice, 0..255), params[:content].try(:slice, 0..255), params[:reply].try(:slice, 0..255), params[:label], User.find_by(ign: params[:author].to_s.strip) || params[:author], params[:query].try(:slice, 0..255), Forum.find_by(id: params[:forum])) .page(params[:page]).per(30) end def show |