Class: Parlez::CommentsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Parlez::CommentsController
- Defined in:
- app/controllers/parlez/comments_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'app/controllers/parlez/comments_controller.rb', line 3 def create @post = Parlez::Post.find(params[:parlez_comment][:post_id]) @comment = Parlez::Comment.create!(params[:parlez_comment]) # FIXME: Add Akismet checking here. @comment.is_spam = false @comment.save! rescue ActiveRecord::RecordNotFound => e flash[:error] = 'Post not found!' redirect_to parlez_posts_path rescue ActiveRecord::RecordInvalid => e @comment = e.record flash[:error] = 'Errors posting your comment!' end |