summaryrefslogtreecommitdiff
path: root/app/controllers/snippets_controller.rb
diff options
context:
space:
mode:
authorAndrew8xx8 <avk@8xx8.ru>2013-03-25 16:28:39 +0400
committerAndrew8xx8 <avk@8xx8.ru>2013-03-25 16:28:39 +0400
commit0359f1d9ec286fbbf58027e2cdb2a307806f54da (patch)
tree6c89fadbbd99f51d6cf830955de8d1ebb0588d88 /app/controllers/snippets_controller.rb
parent3e695acfa2f4035431cb325645b3114d06e43105 (diff)
downloadgitlab-ce-0359f1d9ec286fbbf58027e2cdb2a307806f54da.tar.gz
Codestyle improved
Diffstat (limited to 'app/controllers/snippets_controller.rb')
-rw-r--r--app/controllers/snippets_controller.rb11
1 files changed, 4 insertions, 7 deletions
diff --git a/app/controllers/snippets_controller.rb b/app/controllers/snippets_controller.rb
index 2062ceafa9c..7c96b82379c 100644
--- a/app/controllers/snippets_controller.rb
+++ b/app/controllers/snippets_controller.rb
@@ -31,15 +31,14 @@ class SnippetsController < ApplicationController
end
def new
- @snippet = PersonalSnippet.new
+ @snippet = PersonalSnippet.build
end
def create
- @snippet = PersonalSnippet.new(params[:personal_snippet])
+ @snippet = PersonalSnippet.build(params[:personal_snippet])
@snippet.author = current_user
- @snippet.save
- if @snippet.valid?
+ if @snippet.save
redirect_to snippet_path(@snippet)
else
respond_with @snippet
@@ -50,9 +49,7 @@ class SnippetsController < ApplicationController
end
def update
- @snippet.update_attributes(params[:personal_snippet])
-
- if @snippet.valid?
+ if @snippet.update_attributes(params[:personal_snippet])
redirect_to snippet_path(@snippet)
else
respond_with @snippet