Class: Blog::CommentsController

Inherits:
ApplicationController
  • Object
show all
Includes:
BlogHelper, Rakismet::Controller
Defined in:
app/controllers/blog/comments_controller.rb

Instance Method Summary collapse

Methods included from BlogHelper

#resumer, #tag_cloud, #tags

Instance Method Details

#createObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/controllers/blog/comments_controller.rb', line 7

def create
  @paper = Paper.find(params[:paper_id])
  @comment = @paper.comments.build(params[:comment])
  unless @comment.spam?
    if @comment.valid?
      @comment.save
    else
      @comment.spam!
    end
  else
    flash[:notice] = @comment.akismet_response
  end
  redirect_to([:seo, @paper])
end