diff --git a/controllers/gov_user_plugin_myprofile_controller.rb b/controllers/gov_user_plugin_myprofile_controller.rb index 4d14d3d..6b4d03e 100644 --- a/controllers/gov_user_plugin_myprofile_controller.rb +++ b/controllers/gov_user_plugin_myprofile_controller.rb @@ -6,9 +6,11 @@ class GovUserPluginMyprofileController < MyProfileController def edit_institution @show_sisp_field = environment.admins.include?(current_user.person) - @state_list = NationalRegion.find(:all, :conditions => - { :national_region_type_id => 2 }, - :order => 'name') + @state_list = NationalRegion.find( + :all, + :conditions => { :national_region_type_id => 2 }, + :order => 'name' + ) @institution = @profile.institution update_institution if request.post? end @@ -26,7 +28,11 @@ class GovUserPluginMyprofileController < MyProfileController _("Could not find Governmental Power or Governmental Sphere")) end end - flash[:errors] = @institution.errors.full_messages unless @institution.valid? + if @institution.valid? + redirect_to :controller => 'profile_editor', :action => 'index', :profile => profile.identifier + else + flash[:errors] = @institution.errors.full_messages + end end def governmental_updates diff --git a/views/gov_user_plugin_myprofile/edit_institution.html.erb b/views/gov_user_plugin_myprofile/edit_institution.html.erb index 06d2c04..7b0f936 100644 --- a/views/gov_user_plugin_myprofile/edit_institution.html.erb +++ b/views/gov_user_plugin_myprofile/edit_institution.html.erb @@ -6,23 +6,20 @@ <%end %> -<% unless flash[:errors].nil? %> -