You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
educoder/app/controllers/tidings_controller.rb

19 lines
588 B

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