jackc / tod

Time of day and shift types for Ruby
MIT License
435 stars 56 forks source link

Rails 6 TypeError #74

Closed TildaDares closed 4 years ago

TildaDares commented 4 years ago

When I try to use the tod gem for my rails app I get a TypeError can't convert nil into Integer. It gets stuck on the first line in the create action in my controller.

def create
    @event = current_user.hosted_events.build(event_params)
    if @event.save
      flash[:notice] = "Event Created"
      redirect_to user_path(current_user)
end

This is my event.rb file

require 'tod/core_extensions'
class Event < ApplicationRecord
  serialize :start_time, Tod::TimeOfDay
end