diff --git a/app/controllers/events_controller.rb b/app/controllers/events_controller.rb index 4ba95c96..2a9c7a79 100644 --- a/app/controllers/events_controller.rb +++ b/app/controllers/events_controller.rb @@ -6,7 +6,7 @@ class EventsController < ApplicationController before_action :set_events, only: [:index] before_action :set_event, except: %i[index new preview_create create] - before_action :set_create_event, only: %i[preview_create create] + before_action :set_create_event, only: %i[new preview_create create] before_action :check_secret, only: %i[edit preview update destroy] before_action :set_mailer_host rescue_from ActiveRecord::StaleObjectError, with: :locked @@ -22,13 +22,7 @@ class EventsController < ApplicationController end # GET /events/new - def new - time = Time.zone.now.change(min: 0) + 1.day - @event = Event.new start_time: time, - end_time: time + 1.hour, - region_id: session[:region], - tag_list: params[:tag_list] - end + def new; end # POST /events/preview def preview_create @@ -101,6 +95,12 @@ class EventsController < ApplicationController end def set_create_event + time = Time.zone.now.change(min: 0) + 1.day + params[:event] ||= { + start_time: time, + end_time: time + 1.hour, + region_id: session[:region] + } @event = Event.new event_params end