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/users/grade_records_controller.rb

18 lines
442 B

class Users::GradeRecordsController < Users::BaseController
before_action :private_user_resources!
def show
grades = observed_user.grades
type = params[:type].to_s.strip
grades =
case type
when 'income' then grades.where('score > 0')
when 'cost' then grades.where('score < 0')
else grades
end
@count = grades.count
@grade_records = paginate(grades.order(created_at: :desc))
end
end