Skip to content

Commit aafc3da

Browse files
Agregar mensaje de error cuando no existe usuario
1 parent ab175d7 commit aafc3da

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

app/controllers/workspaces_controller.rb

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,16 @@ def destroy
6060
# POST /workspaces/1/share
6161
def share
6262
new_user = User.find_by(email: params[:email])
63-
@workspace.give_access(new_user)
63+
64+
if new_user
65+
@workspace.give_access(new_user)
66+
flash[:notice] = "Se compartió"
67+
else
68+
flash[:alert] = "No se encontró el usuario"
69+
end
70+
6471
respond_to do |format|
65-
format.html { redirect_to @workspace, notice: "Se compartió" }
72+
format.html { redirect_to @workspace }
6673
end
6774
end
6875

0 commit comments

Comments
 (0)