Class: Knitkit::CommentsController

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

Instance Method Summary collapse

Methods inherited from BaseController

#view_current_publication, #website

Instance Method Details

#addObject



3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'app/controllers/knitkit/comments_controller.rb', line 3

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

#set_sectionObject

no section to set



18
19
20
# File 'app/controllers/knitkit/comments_controller.rb', line 18

def set_section
  false
end