Class: Blogit::CommentsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/blogit/comments_controller.rb

Instance Method Summary (collapse)

Methods inherited from ApplicationController

blogit_authenticate, blogit_conf, #blogit_conf, #current_blogger, #this_blogger?

Instance Method Details

- (Object) create



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'app/controllers/blogit/comments_controller.rb', line 16

def create
  respond_to do |format|
    format.js {
      # the rest is dealt with in the view
      comment.save
    }

    format.html { 
      if comment.save 
        redirect_to(post, notice: "Successfully added comment!")
      else
        render "blogit/posts/show"
      end
    }

  end

end

- (Object) destroy



35
36
37
38
39
40
41
# File 'app/controllers/blogit/comments_controller.rb', line 35

def destroy
  comment.destroy
  respond_to do |format|
    format.html { redirect_to(post, notice: "Successfully removed comment.") }        
    format.js
  end
end