AutoCommit Son Aug 2 17:03:02 CEST 2015

This commit is contained in:
Andreas Stephanides
2015-08-02 17:03:03 +02:00
parent bbb924fcfb
commit 1a12a3d394
4 changed files with 21 additions and 14 deletions

View File

@@ -22,8 +22,11 @@ class CommentsController < ApplicationController
end
end
def new
@comment = Comment.new
@comment.commentable=params[:commentable_type].constantize.find(params[:commentable_id]) unless params[:commentable_type].nil? or params[:commentable_id].nil?
authorize! :comment, @comment.commentable
respond_to do |format|
format.js
end
@@ -40,6 +43,7 @@ class CommentsController < ApplicationController
params_new= params[:comment].select {|i| !["commentable_id", "commentable_type"].include?(i)}
c = params[:comment][:commentable_type].constantize.find(params[:comment][:commentable_id]) unless params[:comment][:commentable_type].nil? or params[:comment][:commentable_id].nil?
authorize! :comment, c
@comment = Comment.build_for(c, current_user,"", params_new)