diff --git a/app/controllers/management/personal_profiles_controller.rb b/app/controllers/management/personal_profiles_controller.rb index 7997b7b..5bc4de6 100644 --- a/app/controllers/management/personal_profiles_controller.rb +++ b/app/controllers/management/personal_profiles_controller.rb @@ -26,18 +26,18 @@ module Management def new @conference = find_conference - @profile = @conference.participant_profiles. - build(user_id: params[:user_id]) + @user = User.find params[:user_id] + @profile = @user.build_personal_profile(@conference) end def create @conference = find_conference - @profile = PersonalProfile.new(profile_params) - @profile.conference = @conference + @user = User.find(profile_params[:user_id]) + @profile = @user.build_personal_profile(@conference, profile_params) if @profile.save - flash[:notice] = 'Profile was successfully created.' - redirect_to action: :index + flash[:notice] = t('.successfully_created') + redirect_to management_conference_personal_profile_path(@profile, conference_id: @conference.id) else render action: :new end diff --git a/config/locales/bg.yml b/config/locales/bg.yml index d93361a..848de07 100644 --- a/config/locales/bg.yml +++ b/config/locales/bg.yml @@ -4,6 +4,8 @@ bg: index: no_profile: 'Този потребител няма въведен профил за текущата конференция.' total: "%{current} от общо %{total}" + create: + successfully_created: "Профилът беше създаден успешно." conferences: show: summary: 'Обобщение'