View difference between Paste ID: tKWZdeps and SXJb0TsA
SHOW: | | - or go back to the newest paste.
1-
@user = User.joins(:user_subscriptions)
1+
@user = User.joins("left join user_subscriptions on user_subscriptions.user_id = users.id left join film_tickets on film_tickets.user_id = users.id left join promotion_cards on film_tickets.promotion_card_id = promotion_cards.id")
2-
          .where('user_subscriptions.friendly_code ILIKE :kode', kode: truncated_card_code)
2+
          .where('user_subscriptions.friendly_code ILIKE :kode or promotion_cards.card_code ILIKE :kode', kode: truncated_card_code)
3-
          .first
3+
          .first