Class: Cfp::CommentsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/cfp/comments_controller.rb

Instance Method Summary collapse

Instance Method Details

#check_for_reviewerObject



26
27
28
# File 'app/controllers/cfp/comments_controller.rb', line 26

def check_for_reviewer
  redirect_to :proposals unless current_user.can_review?
end

#createObject



16
17
18
19
20
21
22
23
24
# File 'app/controllers/cfp/comments_controller.rb', line 16

def create
  @comment = @proposal.comments.build(params[:comment])
  @comment.user = current_user
  if @comment.save
    redirect_to proposal_comments_path(@proposal)
  else
    render :action => :new
  end
end

#indexObject



8
9
10
# File 'app/controllers/cfp/comments_controller.rb', line 8

def index
  @comments = @proposal.comments
end

#load_proposalObject



30
31
32
# File 'app/controllers/cfp/comments_controller.rb', line 30

def load_proposal
  @proposal = Proposal.find(params[:proposal_id])
end

#newObject



12
13
14
# File 'app/controllers/cfp/comments_controller.rb', line 12

def new
  @comment = Comment.new
end