File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ def followed_by?(user)
6060 has_many :user_blockings , dependent : :destroy
6161 has_many :blocked_users , through : :user_blockings , source : :blocked_user
6262 def blocked_by_users
63- User . where ( id : UserBlocking . where ( blocked_user_id : self . id ) . pluck ( :user_id ) )
63+ @cached_blocked_by_users ||= User . where ( id : UserBlocking . where ( blocked_user_id : self . id ) . pluck ( :user_id ) )
6464 end
6565 def blocked_by? ( user )
6666 blocked_by_users . pluck ( :id ) . include? ( user . id )
@@ -206,7 +206,7 @@ def name
206206 end
207207
208208 def image_url ( size = 80 )
209- if avatar . attached? # manually-uploaded avatar
209+ @cached_user_image_url ||= if avatar . attached? # manually-uploaded avatar
210210 Rails . application . routes . url_helpers . rails_representation_url ( avatar . variant ( resize_to_limit : [ size , size ] ) . processed , only_path : true )
211211
212212 else # otherwise, grab the default from Gravatar for this email address
@@ -243,7 +243,7 @@ def active_promotions
243243 end
244244
245245 def active_promo_codes
246- PageUnlockPromoCode . where ( id : active_promotions . pluck ( :page_unlock_promo_code_id ) )
246+ @cached_active_promo_codes ||= PageUnlockPromoCode . where ( id : active_promotions . pluck ( :page_unlock_promo_code_id ) )
247247 end
248248
249249 def initialize_stripe_customer
You can’t perform that action at this time.
0 commit comments