소스 검색

filter instead of map, on carousel transition

Kylie Jo Swistak 5 년 전
부모
커밋
d224990300
2개의 변경된 파일3개의 추가작업 그리고 3개의 파일을 삭제
  1. 1 1
      app/carousels/user.rb
  2. 2 2
      app/models/carousels.rb

+ 1 - 1
app/carousels/user.rb

@@ -19,7 +19,7 @@ class UserCarousel < Carousel
   def self.transition(event, carousel, user)
     # Character array
     all_chars = Character.where(active: 'Active', user_id: user.id).order(:rating)
-    sfw_chars = all_chars.map{ |c| c.rating == 'SFW' }
+    sfw_chars = all_chars.filter{ |c| c.rating == 'SFW' }
     chars = event.channel.nsfw? ? all_chars : sfw_chars
 
     # Update carousel to reflect new information

+ 2 - 2
app/models/carousels.rb

@@ -19,8 +19,8 @@ class Carousel < ActiveRecord::Base
       # Member List
       GuildCarousel.update_embed(event, self)
     end
-  #rescue StandardError => e
-    #error_embed(e.message)
+  rescue StandardError => e
+    error_embed(e.message)
   end
 
   def close(event)