main
main copied to clipboard
handle when a user doesn't have access to an event
When a user requests a url for an event which isn't in a group which has been randomly chosen as the current one then it throws up a 500 error.
ActiveRecord::RecordNotFound in EventsController#show Couldn't find Event with 'id'=2 [WHERE "events_groups"."group_id" = $1]
Extracted source (around line #39): 37 38 39 40 41
def set_event @event = current_group.events.find(params[:id]) end end
Rails.root: /Users/rabble/code/advocacycommons
Application Trace | Framework Trace | Full Trace app/controllers/events_controller.rb:39:in `set_event' Request
Parameters:
{"id"=>"2"}
This is even if the current user IS a member of that group. We need to catch this and handle it cleanly. Also make sure that scoping happens with cancan.
Need to verify whether this still happens.