Last active
February 11, 2017 01:14
-
-
Save mfifth/482248e100cf0ae812638580bdb987b2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ArgumentError in EventsController#save_event | |
| invalid date | |
| Extracted source (around line #8): | |
| @event = Event.new(event_params) | |
| @event.start_date = params[:event][:start_date_date].to_datetime | |
| @event.end_date = params[:event][:end_date_date].to_datetime | |
| if params['redirect_to'] | |
| redirect = params['redirect_to'] | |
| else |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| >> params | |
| => <ActionController::Parameters {"utf8"=>"✓", "authenticity_token"=>"uWyyQe6P1Gsw86V3FvPJxUSEIgtR97vFQ8U6ZY9D9AOkhWZcjjhE1bVfLw+fL3toUxUzILzPsXz1ePmsRXl6Pg==", "event"=><ActionController::Parameters {"name"=>"cotton ball", "type_of_event"=>"game", "start_date_date"=>"02/12/2017", "end_date_date"=>"02/13/2017", "location_name"=>"cotton arena", "address"=>"cotton street", "city"=>"cotton city", "state"=>"CA", "zip"=>"90210", "details"=>"we're pickin cotton!!", "send_alert"=>"0", "send_text"=>"0", "send_email"=>"0", "phone"=>"999-999-9999", "email"=>"me@mail.com", "alert_days"=>"", "user_id"=>"45"} permitted: false>, "redirect_to"=>"/my-activity", "controller"=>"events", "action"=>"save_event"} permitted: false> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def save_event | |
| @event = Event.new(event_params) | |
| @event.start_date = params[:event][:start_date_date].to_datetime | |
| @event.end_date = params[:event][:end_date_date].to_datetime | |
| if params['redirect_to'] | |
| redirect = params['redirect_to'] | |
| else | |
| redirect = '/my-activity' | |
| end | |
| respond_to do |format| | |
| if @event.save | |
| format.html { redirect_to redirect, notice: 'Event was successfully created.' } | |
| format.json { render :show, status: :created, location: @event } | |
| else | |
| format.html { render :new } | |
| format.json { render json: @event.errors, status: :unprocessable_entity } | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment