Sha256: cb7f1853c729e359a5537812cc3dfe6adcc08c01b9f07d9059fe6b4eee68d1f9

Contents?: true

Size: 635 Bytes

Versions: 2

Compression:

Stored size: 635 Bytes

Contents

module Knitkit
  class CommentsController < BaseController
    def add
      user    = current_user
      content = Content.find(params[:content_id])
      comment = params[:comment]

      @comment = content.add_comment({:commentor_name => user.party.description, :email => user.email, :comment => comment})

      if @comment.valid?
        render :json => {:success => true, :message => 'Comment pending approval'}
      else
        render :json => {:success => false, :message => 'Error. Comment cannot be blank'}
      end
    end

    #no section to set
    def set_section
      false
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
knitkit-3.2.0 app/controllers/knitkit/comments_controller.rb
knitkit-3.0.0 app/controllers/knitkit/comments_controller.rb