update controller action to render error in form
This commit is contained in:
parent
b82fdf6257
commit
fd5062a848
|
@ -82,10 +82,7 @@ class GroupsController < Groups::ApplicationController
|
||||||
if Groups::UpdateService.new(@group, current_user, group_params).execute
|
if Groups::UpdateService.new(@group, current_user, group_params).execute
|
||||||
redirect_to edit_group_path(@group), notice: "Group '#{@group.name}' was successfully updated."
|
redirect_to edit_group_path(@group), notice: "Group '#{@group.name}' was successfully updated."
|
||||||
else
|
else
|
||||||
error = group.errors.full_messages.first
|
render action: "edit"
|
||||||
alert_message = "Group '#{@group.name}' cannot be updated: " + error
|
|
||||||
|
|
||||||
redirect_to edit_group_path(@group.reload), alert: alert_message
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue