app/controllers/rsvps_controller.rb in hackathon_manager-0.2.0 vs app/controllers/rsvps_controller.rb in hackathon_manager-0.3.0

- old
+ new

@@ -20,27 +20,29 @@ @questionnaire.acc_status_author_id = current_user.id @questionnaire.acc_status_date = Time.now if @questionnaire.save Mailer.delay.rsvp_confirmation_email(@questionnaire.id) else - flash[:notice] = "There was an error submitting your response, please check over your application and try again. Did you accept the BrickHack Agreement?" + flash[:notice] = rsvp_error_notice end redirect_to rsvp_path end # GET /rsvp/deny def deny @questionnaire.acc_status = "rsvp_denied" @questionnaire.acc_status_author_id = current_user.id @questionnaire.acc_status_date = Time.now unless @questionnaire.save - flash[:notice] = "There was an error submitting your response, please check over your application and try again. Did you accept the BrickHack Agreement?" + flash[:notice] = rsvp_error_notice end redirect_to rsvp_path end # PUT /rsvp + # rubocop:disable CyclomaticComplexity + # rubocop:disable PerceivedComplexity def update unless @questionnaire.update_attributes(params.require(:questionnaire).permit(:agreement_accepted, :phone)) flash[:notice] = @questionnaire.errors.full_messages.join(", ") redirect_to rsvp_path return @@ -79,9 +81,14 @@ redirect_to rsvp_path end private + + def rsvp_error_notice + hackathon_name = Rails.configuration.hackathon['name'] + "There was an error submitting your response, please check over your application and try again. Did you accept the #{hackathon_name} Agreement?" + end def find_questionnaire @questionnaire = current_user.questionnaire end