Commit daa90e11 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Fix 500 error when try to create project snippet without content

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 5ea5e8f5
...@@ -30,9 +30,14 @@ class Projects::SnippetsController < Projects::ApplicationController ...@@ -30,9 +30,14 @@ class Projects::SnippetsController < Projects::ApplicationController
def create def create
@snippet = CreateSnippetService.new(@project, current_user, @snippet = CreateSnippetService.new(@project, current_user,
snippet_params).execute snippet_params).execute
if @snippet.valid?
respond_with(@snippet, respond_with(@snippet,
location: namespace_project_snippet_path(@project.namespace, location: namespace_project_snippet_path(@project.namespace,
@project, @snippet)) @project, @snippet))
else
render :new
end
end end
def edit def edit
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment