Skip to content

Commit

Permalink
Agregar mensaje de error cuando no existe usuario
Browse files Browse the repository at this point in the history
  • Loading branch information
luciagirasoles committed Sep 15, 2022
1 parent ab175d7 commit aafc3da
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions app/controllers/workspaces_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,16 @@ def destroy
# POST /workspaces/1/share
def share
new_user = User.find_by(email: params[:email])
@workspace.give_access(new_user)

if new_user
@workspace.give_access(new_user)
flash[:notice] = "Se compartió"
else
flash[:alert] = "No se encontró el usuario"
end

respond_to do |format|
format.html { redirect_to @workspace, notice: "Se compartió" }
format.html { redirect_to @workspace }
end
end

Expand Down

0 comments on commit aafc3da

Please sign in to comment.