Class: Blogr::CommentsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Blogr::CommentsController
- Defined in:
- app/controllers/blogr/comments_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
26 27 28 29 30 31 32 33 34 |
# File 'app/controllers/blogr/comments_controller.rb', line 26 def create @comment = Comment.new(tag_params) if @comment.save redirect_to @comment, notice: 'Comment was successfully created.' else render action: 'new' end end |
#destroy ⇒ Object
44 45 46 47 |
# File 'app/controllers/blogr/comments_controller.rb', line 44 def destroy @comment.destroy redirect_to comments_path, notice: 'Comment was successfully destroyed.' end |
#edit ⇒ Object
22 23 24 |
# File 'app/controllers/blogr/comments_controller.rb', line 22 def edit @title = "Editing Comment by '#{@comment.author_name}'" end |
#index ⇒ Object
8 9 10 11 |
# File 'app/controllers/blogr/comments_controller.rb', line 8 def index @title = "Comments" @comments = Blogr::Comment.all end |
#new ⇒ Object
17 18 19 20 |
# File 'app/controllers/blogr/comments_controller.rb', line 17 def new @comment = Comment.new @title = "New Comment" end |
#show ⇒ Object
13 14 15 |
# File 'app/controllers/blogr/comments_controller.rb', line 13 def show @title = "Comment ##{@comment.id}" end |
#update ⇒ Object
36 37 38 39 40 41 42 |
# File 'app/controllers/blogr/comments_controller.rb', line 36 def update if @comment.update(tag_params) redirect_to @comment, notice: 'Comment was successfully updated.' else render action: 'edit' end end |