Class: Course::ExperiencePointsRecordsController

Inherits:
ComponentController show all
Includes:
UsersBreadcrumbConcern
Defined in:
app/controllers/course/experience_points_records_controller.rb

Instance Method Summary collapse

Methods included from ApplicationSignInCallbacksConcern

#sign_in

Methods included from ApplicationPaginationConcern

#page_param

Methods included from ApplicationAnnouncementsConcern

#global_announcements, #unread_global_announcements

Methods included from ApplicationInstanceUserConcern

#current_instance_user

Methods included from ApplicationUserTimeZoneConcern

#set_time_zone

Methods included from ApplicationUserConcern

#handle_access_denied, #publicly_accessible?

Methods included from ApplicationComponentsConcern

#handle_component_not_found

Instance Method Details

#destroyObject

:nodoc:


28
29
30
31
32
33
34
# File 'app/controllers/course/experience_points_records_controller.rb', line 28

def destroy # :nodoc:
  if @experience_points_record.destroy
    destroy_success
  else
    destroy_failure
  end
end

#indexObject

:nodoc:


10
11
12
13
14
15
16
17
18
# File 'app/controllers/course/experience_points_records_controller.rb', line 10

def index # :nodoc:
  updater_ids = @experience_points_records.active.pluck(:updater_id)
  @course_user_preload_service =
    Course::CourseUserPreloadService.new(updater_ids, current_course)

  @experience_points_records =
    @experience_points_records.active.
    includes(:actable, :updater).order(updated_at: :desc).page(page_param)
end

#updateObject


20
21
22
23
24
25
26
# File 'app/controllers/course/experience_points_records_controller.rb', line 20

def update
  if @experience_points_record.update_attributes(experience_points_record_params)
    flash.now[:success] = t('.success')
  else
    flash.now[:danger] = @experience_points_record.errors.full_messages.to_sentence
  end
end