diff options
| author | Andrew8xx8 <avk@8xx8.ru> | 2013-03-25 16:28:39 +0400 |
|---|---|---|
| committer | Andrew8xx8 <avk@8xx8.ru> | 2013-03-25 16:28:39 +0400 |
| commit | 0359f1d9ec286fbbf58027e2cdb2a307806f54da (patch) | |
| tree | 6c89fadbbd99f51d6cf830955de8d1ebb0588d88 /app | |
| parent | 3e695acfa2f4035431cb325645b3114d06e43105 (diff) | |
| download | gitlab-ce-0359f1d9ec286fbbf58027e2cdb2a307806f54da.tar.gz | |
Codestyle improved
Diffstat (limited to 'app')
| -rw-r--r-- | app/controllers/projects/snippets_controller.rb | 7 | ||||
| -rw-r--r-- | app/controllers/snippets_controller.rb | 11 |
2 files changed, 6 insertions, 12 deletions
diff --git a/app/controllers/projects/snippets_controller.rb b/app/controllers/projects/snippets_controller.rb index 92e88de6790..1165fa1c583 100644 --- a/app/controllers/projects/snippets_controller.rb +++ b/app/controllers/projects/snippets_controller.rb @@ -29,9 +29,8 @@ class Projects::SnippetsController < Projects::ApplicationController def create @snippet = @project.snippets.build(params[:project_snippet]) @snippet.author = current_user - @snippet.save - if @snippet.valid? + if @snippet.save redirect_to project_snippet_path(@project, @snippet) else respond_with(@snippet) @@ -42,9 +41,7 @@ class Projects::SnippetsController < Projects::ApplicationController end def update - @snippet.update_attributes(params[:project_snippet]) - - if @snippet.valid? + if @snippet.update_attributes(params[:project_snippet]) redirect_to project_snippet_path(@project, @snippet) else respond_with(@snippet) 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 |
