diff --git a/app/controllers/application_letters_controller.rb b/app/controllers/application_letters_controller.rb index 4f9b204f..084703de 100644 --- a/app/controllers/application_letters_controller.rb +++ b/app/controllers/application_letters_controller.rb @@ -21,6 +21,8 @@ def new return redirect_to user_session_path, :alert => message elsif not current_user.profile.present? message = I18n.t('application_letters.fill_in_profile_before_creation') + flash[:event_id] = params[:event_id] + flash.keep(:event_id) return redirect_to new_profile_path, :alert => message end @application_letter = ApplicationLetter.new diff --git a/app/controllers/profiles_controller.rb b/app/controllers/profiles_controller.rb index f4e79b8f..97eb7d77 100644 --- a/app/controllers/profiles_controller.rb +++ b/app/controllers/profiles_controller.rb @@ -15,6 +15,7 @@ def show # GET /profiles/new def new @profile = Profile.new + flash.keep(:event_id) end # GET /profiles/1/edit @@ -27,7 +28,11 @@ def create @profile.user_id = current_user.id if @profile.save - redirect_to @profile, notice: 'Profile was successfully created.' + if flash[:event_id] + redirect_to new_application_letter_path(:event_id => flash[:event_id]) + else + redirect_to @profile + end else render :new end