Skip to content

Instantly share code, notes, and snippets.

@nkabardin
Created January 28, 2013 09:40
Show Gist options
  • Save nkabardin/4654269 to your computer and use it in GitHub Desktop.
Save nkabardin/4654269 to your computer and use it in GitHub Desktop.
def thank_you
authenticate_user!
redirect_to(coupons_path) and return unless session[:payment_id]
@payment = Payment.find(session.delete(:payment_id))
offers = Offer.usual.city(current_user.city).public_only.published
if @payment.purpose == 'order'
deal = @payment.offer.offer_description
offers -= (deal.main_multi_merchant_deal || deal).offers
end
@offers = Recommender.thanks_page(current_user, deal, offers).first(3)
@offers = offers.uniq(&:offer_description_id).first(3) if @offers.size < 3
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment