Sha256: ff9ce78aa709fa818045707b7f69dd0635e9b23e98de0f2922fa70b3a36f8047

Contents?: true

Size: 761 Bytes

Versions: 64

Compression:

Stored size: 761 Bytes

Contents

class ExerciseSolutionsController < AjaxController
  include Mumuki::Laboratory::Controllers::NestedInExercise
  include Mumuki::Laboratory::Controllers::ResultsRendering
  include Mumuki::Laboratory::Controllers::ExerciseSeed

  before_action :set_messages, only: :create
  before_action :validate_accessible!, only: :create

  def create
    assignment = @exercise.try_submit_solution!(current_user, solution_params)
    render_results_json assignment, status: assignment.status
  end

  private

  def accessible_subject
    @exercise.navigable_parent
  end

  def set_messages
    @messages = @exercise.messages_for(current_user)
  end

  def solution_params
    params_h = params.require(:solution).permit!.to_h
    {content: params_h[:content]}
  end
end

Version data entries

64 entries across 64 versions & 1 rubygems

Version Path
mumuki-laboratory-7.6.2 app/controllers/exercise_solutions_controller.rb
mumuki-laboratory-7.6.1 app/controllers/exercise_solutions_controller.rb
mumuki-laboratory-7.6.0 app/controllers/exercise_solutions_controller.rb
mumuki-laboratory-7.5.2 app/controllers/exercise_solutions_controller.rb
mumuki-laboratory-7.5.1 app/controllers/exercise_solutions_controller.rb
mumuki-laboratory-7.5.0 app/controllers/exercise_solutions_controller.rb
mumuki-laboratory-7.4.2 app/controllers/exercise_solutions_controller.rb
mumuki-laboratory-7.4.1 app/controllers/exercise_solutions_controller.rb
mumuki-laboratory-7.4.0 app/controllers/exercise_solutions_controller.rb
mumuki-laboratory-7.3.1 app/controllers/exercise_solutions_controller.rb
mumuki-laboratory-7.3.0 app/controllers/exercise_solutions_controller.rb
mumuki-laboratory-7.2.0 app/controllers/exercise_solutions_controller.rb
mumuki-laboratory-7.1.0 app/controllers/exercise_solutions_controller.rb
mumuki-laboratory-7.0.12 app/controllers/exercise_solutions_controller.rb
mumuki-laboratory-7.0.11 app/controllers/exercise_solutions_controller.rb
mumuki-laboratory-7.0.10 app/controllers/exercise_solutions_controller.rb
mumuki-laboratory-7.0.9 app/controllers/exercise_solutions_controller.rb
mumuki-laboratory-7.0.8 app/controllers/exercise_solutions_controller.rb
mumuki-laboratory-7.0.7 app/controllers/exercise_solutions_controller.rb
mumuki-laboratory-7.0.6 app/controllers/exercise_solutions_controller.rb