unRARed/freednd

Campaigns#index blowing up when no `current_user`

Opened this issue · 0 comments

Started GET "/campaigns" for 3.235.45.196 at 2020-08-09 06:07:15 +0000
Processing by CampaignsController#index as HTML
  Rendering campaigns/index.html.slim within layouts/application
  Rendered campaigns/index.html.slim within layouts/application (Duration: 21.5ms | Allocations: 2946)
Completed 500 Internal Server Error in 23ms (ActiveRecord: 9.0ms | Allocations: 3385)
ActionView::Template::Error (undefined method `available_characters' for nil:NilClass):
     7:           strong = campaign.name
     8:           br = campaign.description
     9:           - unless campaign.users.include? current_user
    10:             - if current_user.available_characters.any?
    11:               = form_with(\
    12:                 url: join_campaign_path(campaign), method: 'POST'\
    13:               ) do |form|
[9b52918d-03e1-449a-96f2-bcc5590595fc]
app/views/campaigns/index.html.slim:10
app/views/campaigns/index.html.slim:4:in `each'
app/views/campaigns/index.html.slim:4
app/views/campaigns/index.html.slim:2:in `each_slice'
app/views/campaigns/index.html.slim:2