class TidingsController < ApplicationController def index tidings = current_user.tidings.order(created_at: :desc) tiding_types = case params[:type] when 'notice' then 'System' when 'apply' then 'Apply' when 'course' then %w(HomeworkCommon Exercise Poll) when 'project' then 'Project' when 'interaction' then %w(Comment Mentioned Praise Fan) end tidings = tidings.where(tiding_type: tiding_types) if tiding_types.present? @count = tidings.count @tidings = paginate tidings end end