ensl.org/app/controllers/match_proposals_controller.rb

35 lines
715 B
Ruby
Raw Normal View History

2017-05-01 14:57:32 +00:00
class MatchProposalsController < ApplicationController
before_filter :get_match
2017-05-01 14:57:32 +00:00
def index
end
def new
@proposal = MatchProposal.new
@proposal.match = @match
raise AccessError unless @proposal.can_create? cuser
2017-05-01 14:57:32 +00:00
end
def create
@proposal = MatchProposal.new(params[:match_proposal])
@proposal.match = @match
raise AccessError unless @proposal.can_create? cuser
@proposal.team = cuser.team
@proposal.status = MatchProposal::STATUS_PENDING
if @proposal.save!
flash[:notice] = 'Created new proposal'
redirect_to(@match)
else
render :new
end
2017-05-01 14:57:32 +00:00
end
def update
end
private
def get_match
@match = Match.find params[:match_id]
end
2017-05-01 14:57:32 +00:00
end