Class: CommentsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- CommentsController
- Defined in:
- app/controllers/comments_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
15 16 17 18 19 |
# File 'app/controllers/comments_controller.rb', line 15 def create @comment = Comment.new(params[:comment]) @comment.post_id = Post.find(params[:post_id]).id @comment.save end |
#index ⇒ Object
9 10 11 12 13 14 |
# File 'app/controllers/comments_controller.rb', line 9 def index @comments = Comment.all respond_to do |format| format.html # index.html.erb end end |
#show ⇒ Object
3 4 5 6 7 8 |
# File 'app/controllers/comments_controller.rb', line 3 def show @comment = Comment.find(params[:id]) respond_to do |format| format.html # index.html.erb end end |