I am trying to make a calendar in Ruby and it works locally but when I push it to heroku it throws a 500 error.
This is the line that is broken
<%= calendar @date do |date| %>
This is my controller
class CalendarController < ApplicationController
before_action :logged_in_user, only: :show
def show
@date = params[:date] ? Date.parse(params[:date]) : Date.today
@nealdocuments = Nealdocument.all
end
end
The error is
at=info method=GET path="/calendar" host=mysite.herokuapp.com request_id=cacc46e7-455e-47d4-81a7-2fa0a1cc1d14 fwd="67.245.106.146" dyno=web.1 connect=0ms service=159ms status=500 bytes=1785 protocol=https
and
2019-06-05T14:41:01.893927+00:00 app[web.1]: F, [2019-06-05T14:41:01.893864 #17] FATAL -- : [cacc46e7-455e-47d4-81a7-2fa0a1cc1d14] ActionView::Template::Error (uninitialized constant CalendarHelper::Calendar
2019-06-05T14:41:01.893930+00:00 app[web.1]: Did you mean? CalendarHelper):
Without that one line though the page loads.
This is my Helper class
module CalendarHelper
def calendar(date = Date.today, &block)
Calendar.new(self, date, block).table
end
end
::Calendar.new(...)
instead ofCalendar.new(...)
.Calendar
an ActiveRecord class?. This seem like a loading order issue, or something with eager loading class related. What Rails version are you using ?. Try running the app on your computer using production environment, just as it runs on Heroku. I bet you'll get the same error. That way you can debug what's going on.