Created
November 25, 2014 18:08
-
-
Save jontonsoup/fe7e0b0c8db3e5cd20e9 to your computer and use it in GitHub Desktop.
EnrollmentsController
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class EnrollmentsController < ApplicationController | |
def create | |
enrollment_creator = EnrollmentCreator.new(enrollment_params) | |
success = enrollment_creator.save | |
authorize enrollment_creator.enrollment | |
redirect_to programs_url | |
end | |
private | |
def enrollment_params | |
{ program: program, learner: current_user } | |
end | |
def program | |
@program ||= Program.find(params[:program_id]) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment