Skip to content

Instantly share code, notes, and snippets.

@PrimeTimeTran
Created December 29, 2017 09:11
Show Gist options
  • Save PrimeTimeTran/7d7c5c2c5828d2aeee4e07f4b123ede7 to your computer and use it in GitHub Desktop.
Save PrimeTimeTran/7d7c5c2c5828d2aeee4e07f4b123ede7 to your computer and use it in GitHub Desktop.
def create
@comment = current_user.comments.create!(comment_params)
@parent = params[:comment][:parent_id]
PostMailer.commented_post(@comment.post.user_id, current_user).deliver_now unless Post.mine?(@comment.post.id, current_user)
Rb::PhotoUploadService.upload(current_user.id, self.class, @comment.id, params[:comment][:photo]) if params[:comment][:photo]
respond_to do |format|
if @comment.save
format.html { redirect_back(fallback_location: root_path) }
format.js
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment