@@ -13,16 +13,17 @@ def index
1313 events << Event . past . includes ( :venue , :sponsors ) . limit ( RECENT_EVENTS_DISPLAY_LIMIT )
1414 events = events . compact . flatten . sort_by ( &:date_and_time ) . reverse . first ( RECENT_EVENTS_DISPLAY_LIMIT )
1515 events_hash_grouped_by_date = events . group_by ( &:date )
16- @past_events = events_hash_grouped_by_date . map . inject ( { } ) do |hash , ( key , value ) |
16+ @past_events = events_hash_grouped_by_date . map . each_with_object ( { } ) do |( key , value ) , hash |
1717 hash [ key ] = EventPresenter . decorate_collection ( value )
18- hash
1918 end
2019
2120 events = [ Workshop . includes ( :chapter ) . upcoming . joins ( :chapter ) . merge ( Chapter . active ) ]
2221 events << Meeting . upcoming . all
2322 events << Event . upcoming . includes ( :venue , :sponsors ) . all
2423 events = events . compact . flatten . sort_by ( &:date_and_time ) . group_by ( &:date )
25- @events = events . map . inject ( { } ) { |hash , ( key , value ) | hash [ key ] = EventPresenter . decorate_collection ( value ) ; hash }
24+ @events = events . map . each_with_object ( { } ) do |( key , value ) , hash |
25+ hash [ key ] = EventPresenter . decorate_collection ( value )
26+ end
2627 end
2728
2829 def show
@@ -34,7 +35,7 @@ def show
3435 return unless logged_in?
3536
3637 invitation = Invitation . find_by ( member : current_user , event : event , attending : true )
37- return redirect_to event_invitation_path ( @event , invitation ) if invitation
38+ redirect_to event_invitation_path ( @event , invitation ) if invitation
3839 end
3940
4041 def student
@@ -74,6 +75,6 @@ def find_invitation_and_redirect_to_event(role)
7475 end
7576
7677 def set_event
77- @event = Event . find_by ( slug : params [ :event_id ] )
78+ @event = Event . find_by! ( slug : params [ :event_id ] )
7879 end
7980end
0 commit comments