Class: RailsBlogEngine::CommentsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- RailsBlogEngine::CommentsController
- Defined in:
- app/controllers/rails_blog_engine/comments_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'app/controllers/rails_blog_engine/comments_controller.rb', line 8 def create @comment = @post.comments.create(params[:comment]) do |c| # Record some extra information from our environment. Most of this # is used by the spam filter. c. = request.remote_ip c. = request.env['HTTP_USER_AGENT'] c. = can?(:create, RailsBlogEngine::Post) c.referrer = request.env['HTTP_REFERER'] end if @comment.valid? @comment.run_spam_filter if @comment.filtered_as_spam? flash[:comment_notice] = "Your comment has been held for moderation." redirect_to(post_permalink_path(@post) + '#comment-flash') else redirect_to(post_permalink_path(@post) + "#comment-#{@comment.id}") end else render "new" end end |
#mark_as_ham ⇒ Object
36 37 38 39 |
# File 'app/controllers/rails_blog_engine/comments_controller.rb', line 36 def mark_as_ham @comment.mark_as_ham! redirect_to(post_permalink_path(@post) + "#comment-#{@comment.id}") end |
#mark_as_spam ⇒ Object
31 32 33 34 |
# File 'app/controllers/rails_blog_engine/comments_controller.rb', line 31 def mark_as_spam @comment.mark_as_spam! redirect_to(post_permalink_path(@post) + "#comment-#{@comment.id}") end |