Select Call type when creating; don't switch types.

This commit is contained in:
James Mason 2018-10-18 12:00:20 -07:00
parent e518431b8e
commit 75bf1380ba
4 changed files with 22 additions and 14 deletions

View file

@ -11,7 +11,7 @@ module Admin
def show; end
def new
@cfp = @program.cfps.new
@cfp = @program.cfps.new(cfp_params_or_first_remaining_type)
end
def edit; end
@ -59,5 +59,11 @@ module Admin
def cfp_params
params.require(:cfp).permit(:start_date, :end_date, :description, :cfp_type)
end
def cfp_params_or_first_remaining_type
cfp_params
rescue ActionController::ParameterMissing
{ 'cfp_type' => @program.remaining_cfp_types.first }
end
end
end