Sha256: ed8d1f87014bfcd61c0368555653e1854a7f3135ff6c022922e13dd9e66f191a
Contents?: true
Size: 651 Bytes
Versions: 4
Compression:
Stored size: 651 Bytes
Contents
require_dependency "raffle_v1/application_controller" module RaffleV1 class CommentsController < ApplicationController def index @comments = Comment.all respond_to do |format| format.html # index.html.erb format.json { render json: @coments } end end def create @post = Post.find(params[:post_id]) @comment = @post.comments.build(params[:comment]) flash[:notice] = "Comment has been created!" redirect_to post_path end def show @comments = Comment.find(params[:id]) respond_to do |format| format.htmlformat.json { render json: @comment} end end end end
Version data entries
4 entries across 4 versions & 1 rubygems