Class: CommentsController

Inherits:
Spree::BaseController
  • Object
show all
Defined in:
app/controllers/comments_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



8
9
10
11
12
13
14
15
16
17
# File 'app/controllers/comments_controller.rb', line 8

def create
  @comment = @post.comments.build(params[:comment])
  @comment.user = current_user
  if @comment.save
    flash[:notice] = I18n.t(:created_successfully_pending_approval)
    redirect_to post_path(@post)
  else
    render 'new'
  end
end

#newObject



4
5
6
# File 'app/controllers/comments_controller.rb', line 4

def new
  @comment = Comment.new
end