summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authormo k <mo@mokhan.ca>2012-09-27 20:52:04 -0600
committermo k <mo@mokhan.ca>2012-09-27 20:52:04 -0600
commit868cdfb3136d2eceabbd5cd1bb444bd5aa32b09a (patch)
tree9e4c4af15ccd250e3c223525e17bc396874d6572 /app
parent98db5dfbe7a8ae4d44c90e34e4ebef75f2d75efa (diff)
update the comments controller specs
Diffstat (limited to 'app')
-rw-r--r--app/controllers/comments_controller.rb5
-rw-r--r--app/services/comment_on_creation_command.rb1
2 files changed, 3 insertions, 3 deletions
diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb
index 451c5cc9..7fb5e7d3 100644
--- a/app/controllers/comments_controller.rb
+++ b/app/controllers/comments_controller.rb
@@ -6,8 +6,7 @@ class CommentsController < ApplicationController
end
def create
- command_for(CommentOnCreationCommand).run(params)
- flash[:notice] = "Nice Comment!"
- redirect_to :controller => 'creations', :action => 'show', :id => params[:creation_id]
+ comment = command_for(CommentOnCreationCommand).run(params)
+ redirect_to comment.commentable, :notice => 'Nice Comment!'
end
end
diff --git a/app/services/comment_on_creation_command.rb b/app/services/comment_on_creation_command.rb
index 3217dcbd..4fc765b5 100644
--- a/app/services/comment_on_creation_command.rb
+++ b/app/services/comment_on_creation_command.rb
@@ -5,5 +5,6 @@ class CommentOnCreationCommand
def run(params)
comment = @current_user.comment_on(Creation.find(params[:creation_id]), params[:comment][:body])
comment.save
+ comment
end
end