Class: CommentsController

Inherits:
ApplicationController show all
Defined in:
lib/generators/jinda/templates/app/controllers/comments_controller.rb,
lib/generators/jinda/templates/app/controllers/jinda_org/comments_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#prepare_meta_tags

Instance Method Details

#createObject



9
10
11
12
13
# File 'lib/generators/jinda/templates/app/controllers/comments_controller.rb', line 9

def create
  @comment = @commentable.comments.new comment_params
  @comment.save!
  redirect_to [@commentable], notice: "Comment created"
end

#indexObject



5
6
7
# File 'lib/generators/jinda/templates/app/controllers/comments_controller.rb', line 5

def index
  @comments = @commentable.comments 
end