diff options
| author | mo k <mo@mokhan.ca> | 2012-06-09 18:22:17 -0600 |
|---|---|---|
| committer | mo k <mo@mokhan.ca> | 2012-06-09 18:22:17 -0600 |
| commit | f4ffca56553bf051af8741a602a0f4d3c29568f7 (patch) | |
| tree | 300cc0879d1d0bf5c9653de8aacbe61cd799e385 /app/controllers/comments_controller.rb | |
| parent | 412ad055acf666bffe4520e91242bcd9c6040dd6 (diff) | |
refactor comment controller to save a new comment.
Diffstat (limited to 'app/controllers/comments_controller.rb')
| -rw-r--r-- | app/controllers/comments_controller.rb | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb index ba2b2cfe..6ea6f0b1 100644 --- a/app/controllers/comments_controller.rb +++ b/app/controllers/comments_controller.rb @@ -5,17 +5,13 @@ class CommentsController < ApplicationController @comment = Comment.new end - #def create - #creation = Creation.find(params[:creation_id]) - #comment = Comment.build_from(creation, current_user.id, params[:comment][:body]) - #comment.save - #flash[:notice] = params[:comment][:body] - #redirect_to :controller => 'creations', :action => 'show', :id => params[:creation_id] - #end def create - CommentOnCreationCommand.new(current_user).run(params) - + command_for(CommentOnCreationCommand).run(params) flash[:notice] = params[:comment][:body] redirect_to :controller => 'creations', :action => 'show', :id => params[:creation_id] end + + def command_for(command) + command.new(current_user) + end end |
