> NoMethodError in CommentsController#create
undefined method `id' for nil:NilClass
Extracted source (around line #11):
9
10
11
12
13
14
@comment.user = current_user
if @comment.save
id = @comment.post_type == 'Question' ? @comment.post.id : @comment.post.question.id
@comment.post.user.create_notification("New comment on one of your posts", "/questions/#{id}")
if @comment.post_type == 'Question'
redirect_to url_for(:controller => :questions, :action => :show, :id => id)
Rails.root: /home/ubuntu/ws/qpixel