Fix create conference form

- adds HTML 5 validations
This commit is contained in:
Chrisbr 2014-05-12 14:38:55 +02:00
parent adfa9cc871
commit 27f35a49c6
4 changed files with 21 additions and 15 deletions

View file

@ -15,10 +15,13 @@ class Admin::ConferenceController < ApplicationController
def create
@conference = Conference.new(params[:conference])
if @conference.save
redirect_to(admin_conference_path(:id => @conference.short_title), :notice => 'Conference was successfully created.')
if @conference.valid?
@conference.save
redirect_to(admin_conference_path(id: @conference.short_title),
notice: 'Conference was successfully created.')
else
render :action => "new"
redirect_to(new_admin_conference_path,
flash: { error: @conference.errors.full_messages.join('! ') })
end
end