Both iCalendar routes were unusable:
* `/conferences/.../schedule.ics` raised
`NoMethodError: undefined method 'icalendar_proposals'` because the
`ConferenceHelper#icalendar_proposals` helper isn't auto-included in
controllers; the action crashed before rendering.
* `/calendar.ics` silently redirected to `/`. The controller goes
through `load_and_authorize_resource`, which authorises `:calendar`
on `Conference` and is rejected for anonymous visitors because no
ability grants it — CanCan's `AccessDenied` rescue redirects to
root.
The helper is invoked through the controller `helpers` proxy so it
works in both contexts, and the calendar action is opted out of
resource loading and explicitly marked as not requiring authorization
since it serves a public feed across conferences. The helper is also
hardened so that proposals missing a room, difficulty level, track,
event type or scheduled time produce a valid event instead of
crashing the whole feed.
Conferences.incoming is defined on the model as scope:
scope :upcoming, (-> { where('end_date >= ?', Date.current) })
Conference.past
scope :past, (-> { where('end_date < ?', Date.current) })
It used to be a partial inside #index, but having their own page
yields some extra benefits:
- Performance: Move logic from the view to the controller
- Theres' no need to go extra steps inside the :index view
- UI: Remove the extra 'Upcoming Conferences' when the system needs
to start the flow of the creation of the first user
The current codebase will end in a 500 APPLICATION ERROR if Conference#short_title isn't found... this should be a 404 NOT FOUND INSTEAD, which will be handled if we raise ActiveRecord::RecordNotFound.
Added missing image url as well as created twitter card.
validated both with twitter validator and facebook validator.
All passed.
Need to check to see if no image is selected, what is outcome.
The single query was producing a tremendously large ActiveRecord allocation.
While this isn't nearly as cool as one query, it's still a significant
reduction in SQL trips, and now has the bonus of only loading what is
actually going to be displayed.