diff options
author | Andrew8xx8 <avk@8xx8.ru> | 2013-03-24 22:31:14 +0400 |
---|---|---|
committer | Andrew8xx8 <avk@8xx8.ru> | 2013-03-24 22:31:14 +0400 |
commit | 5b35000f16201bd631f161ef6d79b0a77dc2c27b (patch) | |
tree | 903e41d676c1939bae2cb8d6232c7fc9380bbff5 /app/controllers/projects/snippets_controller.rb | |
parent | bc7c5f87bbd5cc25a0aaf03e9e5ecf6a65375098 (diff) |
Snippets feature refactored. Tests now use spinach
Diffstat (limited to 'app/controllers/projects/snippets_controller.rb')
-rw-r--r-- | app/controllers/projects/snippets_controller.rb | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/app/controllers/projects/snippets_controller.rb b/app/controllers/projects/snippets_controller.rb index 4602fbb989a..ebff5039ffa 100644 --- a/app/controllers/projects/snippets_controller.rb +++ b/app/controllers/projects/snippets_controller.rb @@ -27,12 +27,12 @@ class Projects::SnippetsController < Projects::ApplicationController end def create - @snippet = @project.snippets.new(params[:snippet]) + @snippet = @project.snippets.new(params[:project_snippet]) @snippet.author = current_user @snippet.save if @snippet.valid? - redirect_to [@project, @snippet] + redirect_to project_snippet_path(@project, @snippet) else respond_with(@snippet) end @@ -42,10 +42,10 @@ class Projects::SnippetsController < Projects::ApplicationController end def update - @snippet.update_attributes(params[:snippet]) + @snippet.update_attributes(params[:project_snippet]) if @snippet.valid? - redirect_to [@project, @snippet] + redirect_to project_snippet_path(@project, @snippet) else respond_with(@snippet) end @@ -58,7 +58,7 @@ class Projects::SnippetsController < Projects::ApplicationController end def destroy - return access_denied! unless can?(current_user, :admin_snippet, @snippet) + return access_denied! unless can?(current_user, :admin_project_snippet, @snippet) @snippet.destroy @@ -81,11 +81,11 @@ class Projects::SnippetsController < Projects::ApplicationController end def authorize_modify_snippet! - return render_404 unless can?(current_user, :modify_snippet, @snippet) + return render_404 unless can?(current_user, :modify_project_snippet, @snippet) end def authorize_admin_snippet! - return render_404 unless can?(current_user, :admin_snippet, @snippet) + return render_404 unless can?(current_user, :admin_project_snippet, @snippet) end def module_enabled |